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 /fs/pipe.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 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -140,8 +140,7 @@ static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, | |||
140 | struct page *page = buf->page; | 140 | struct page *page = buf->page; |
141 | 141 | ||
142 | if (page_count(page) == 1) { | 142 | if (page_count(page) == 1) { |
143 | if (memcg_kmem_enabled()) | 143 | memcg_kmem_uncharge(page, 0); |
144 | memcg_kmem_uncharge(page, 0); | ||
145 | __SetPageLocked(page); | 144 | __SetPageLocked(page); |
146 | return 0; | 145 | return 0; |
147 | } | 146 | } |