[Devel] [PATCH rh7 2/4] fs: account anon pipe buffers to memcg/kmem
Vladimir Davydov
vdavydov at parallels.com
Wed Aug 26 09:28:14 PDT 2015
https://jira.sw.ru/browse/PSBM-39052
Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
fs/pipe.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/fs/pipe.c b/fs/pipe.c
index 46f1ab264a4c..a09175176e37 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -223,9 +223,12 @@ static void anon_pipe_buf_release(struct pipe_inode_info *pipe,
* temporary page, let's keep track of it as a one-deep
* allocation cache. (Otherwise just release our reference to it)
*/
- if (page_count(page) == 1 && !pipe->tmp_page)
- pipe->tmp_page = page;
- else
+ if (page_count(page) == 1) {
+ if (!pipe->tmp_page)
+ pipe->tmp_page = page;
+ else
+ __free_kmem_pages(page, 0);
+ } else
page_cache_release(page);
}
@@ -585,7 +588,7 @@ redo1:
size_t remaining;
if (!page) {
- page = alloc_page(GFP_HIGHUSER);
+ page = alloc_kmem_pages(GFP_HIGHUSER, 0);
if (unlikely(!page)) {
ret = ret ? : -ENOMEM;
break;
@@ -822,7 +825,7 @@ void free_pipe_info(struct pipe_inode_info *pipe)
buf->ops->release(pipe, buf);
}
if (pipe->tmp_page)
- __free_page(pipe->tmp_page);
+ __free_kmem_pages(pipe->tmp_page, 0);
kfree(pipe->bufs);
kfree(pipe);
}
--
2.1.4
More information about the Devel
mailing list