Re: [PATCH 7/8] pipe: account to kmemcg

From: Vladimir Davydov
Date: Mon May 23 2016 - 06:57:31 EST


On Mon, May 23, 2016 at 06:39:40PM +0800, kbuild test robot wrote:
...
> fs/built-in.o: In function `anon_pipe_buf_steal':
> >> pipe.c:(.text+0x5f8d): undefined reference to `memcg_kmem_uncharge'

From: Vladimir Davydov <vdavydov@xxxxxxxxxxxxx>
Subject: [PATCH] pipe-account-to-kmemcg-fix


diff --git a/fs/pipe.c b/fs/pipe.c
index 6345f3543788..b3ad0b33f04e 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -144,8 +144,10 @@ static int anon_pipe_buf_steal(struct pipe_inode_info *pipe,
struct page *page = buf->page;

if (page_count(page) == 1) {
- memcg_kmem_uncharge(page, 0);
- __ClearPageKmemcg(page);
+ if (memcg_kmem_enabled()) {
+ memcg_kmem_uncharge(page, 0);
+ __ClearPageKmemcg(page);
+ }
__SetPageLocked(page);
return 0;
}