diff options
author | Shakeel Butt <shakeelb@google.com> | 2019-03-05 18:43:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-06 00:07:15 -0500 |
commit | 60cd4bcd62384cfa1e5890cebacccf08b3161156 (patch) | |
tree | 98f36784147eccafe2f042a415ee756ad7f8d07b /mm/page_alloc.c | |
parent | 9234bae9b252bbc231abcabfa644a4eb9724250c (diff) |
memcg: localize memcg_kmem_enabled() check
Move the memcg_kmem_enabled() checks into memcg kmem charge/uncharge
functions, so, the users don't have to explicitly check that condition.
This is purely code cleanup patch without any functional change. Only
the order of checks in memcg_charge_slab() can potentially be changed
but the functionally it will be same. This should not matter as
memcg_charge_slab() is not in the hot path.
Link: http://lkml.kernel.org/r/20190103161203.162375-1-shakeelb@google.com
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Roman Gushchin <guro@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1f9f1409df9b..034b8b6043a3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1056,7 +1056,7 @@ static __always_inline bool free_pages_prepare(struct page *page, | |||
1056 | if (PageMappingFlags(page)) | 1056 | if (PageMappingFlags(page)) |
1057 | page->mapping = NULL; | 1057 | page->mapping = NULL; |
1058 | if (memcg_kmem_enabled() && PageKmemcg(page)) | 1058 | if (memcg_kmem_enabled() && PageKmemcg(page)) |
1059 | memcg_kmem_uncharge(page, order); | 1059 | __memcg_kmem_uncharge(page, order); |
1060 | if (check_free) | 1060 | if (check_free) |
1061 | bad += free_pages_check(page); | 1061 | bad += free_pages_check(page); |
1062 | if (bad) | 1062 | if (bad) |
@@ -4568,7 +4568,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, | |||
4568 | 4568 | ||
4569 | out: | 4569 | out: |
4570 | if (memcg_kmem_enabled() && (gfp_mask & __GFP_ACCOUNT) && page && | 4570 | if (memcg_kmem_enabled() && (gfp_mask & __GFP_ACCOUNT) && page && |
4571 | unlikely(memcg_kmem_charge(page, gfp_mask, order) != 0)) { | 4571 | unlikely(__memcg_kmem_charge(page, gfp_mask, order) != 0)) { |
4572 | __free_pages(page, order); | 4572 | __free_pages(page, order); |
4573 | page = NULL; | 4573 | page = NULL; |
4574 | } | 4574 | } |