[Devel] [PATCH RHEL7 COMMIT] fs: account anon pipe buffers to memcg/kmem

Vladimir Davydov vdavydov at odin.com
Mon Sep 7 03:15:47 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.7
------>
commit 27d43fe0e073f5e40d5289ab336aae21990b53fc
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Mon Sep 7 14:15:47 2015 +0400

    fs: account anon pipe buffers to memcg/kmem
    
    https://jira.sw.ru/browse/PSBM-39052
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Reviewed-by: Kirill Tkhai <ktkhai at odin.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);
 }



More information about the Devel mailing list