aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pipe.c
diff options
context:
space:
mode:
authorShakeel Butt <shakeelb@google.com>2019-03-05 18:43:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 00:07:15 -0500
commit60cd4bcd62384cfa1e5890cebacccf08b3161156 (patch)
tree98f36784147eccafe2f042a415ee756ad7f8d07b /fs/pipe.c
parent9234bae9b252bbc231abcabfa644a4eb9724250c (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.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index bdc5d3c0977d..51d5fd8840ab 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -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 }