[Devel] [PATCH rh7 04/11] ub: do not apply memcg limits on attaching via sys_setluid

Vladimir Davydov vdavydov at parallels.com
Wed May 20 02:00:41 PDT 2015


I don't remember why I did this in the first place. Seems completely
redundant.

Also, rename ub_update_mem_cgroup_limits to ub_update_memcg ot match
ub_sync_memcg.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 include/bc/beancounter.h |    3 +--
 kernel/bc/beancounter.c  |   20 +++++++-------------
 kernel/bc/sys.c          |    2 +-
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/include/bc/beancounter.h b/include/bc/beancounter.h
index e0ef5ec195fa..a70684390171 100644
--- a/include/bc/beancounter.h
+++ b/include/bc/beancounter.h
@@ -317,8 +317,7 @@ extern void __uncharge_beancounter_locked(struct user_beancounter *ub,
 extern void uncharge_warn(struct user_beancounter *ub, const char *resource,
 		unsigned long val, unsigned long held);
 
-extern int ub_update_mem_cgroup_limits(struct user_beancounter *ub);
-
+extern int ub_update_memcg(struct user_beancounter *ub);
 extern void ub_sync_memcg(struct user_beancounter *ub);
 extern void ub_page_stat(struct user_beancounter *ub,
 			 const nodemask_t *nodemask,
diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index d94fb32cd22c..7d226b0dbdac 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -109,9 +109,6 @@ static void ub_cgroup_close(struct cgroup *root, struct cgroup *cg)
 		cgroup_kernel_close(cg);
 }
 
-extern int mem_cgroup_apply_beancounter(struct cgroup *cg,
-					struct user_beancounter *ub);
-
 static int ub_mem_cgroup_attach_task(struct user_beancounter *ub,
 				     struct task_struct *tsk)
 {
@@ -121,12 +118,7 @@ static int ub_mem_cgroup_attach_task(struct user_beancounter *ub,
 	cg = ub_cgroup_open(mem_cgroup_root, ub);
 	if (IS_ERR(cg))
 		return PTR_ERR(cg);
-	if (ub != get_ub0())
-		ret = mem_cgroup_apply_beancounter(cg, ub);
-	else
-		ret = 0;
-	if (!ret)
-		ret = cgroup_kernel_attach(cg, tsk);
+	ret = cgroup_kernel_attach(cg, tsk);
 	ub_cgroup_close(mem_cgroup_root, cg);
 	return ret;
 }
@@ -186,7 +178,12 @@ fail_blkio:
 	goto out;
 }
 
-int ub_update_mem_cgroup_limits(struct user_beancounter *ub)
+extern void mem_cgroup_sync_beancounter(struct cgroup *cg,
+					struct user_beancounter *ub);
+extern int mem_cgroup_apply_beancounter(struct cgroup *cg,
+					struct user_beancounter *ub);
+
+int ub_update_memcg(struct user_beancounter *ub)
 {
 	struct cgroup *cg;
 	int ret;
@@ -202,9 +199,6 @@ int ub_update_mem_cgroup_limits(struct user_beancounter *ub)
 	return ret;
 }
 
-extern void mem_cgroup_sync_beancounter(struct cgroup *cg,
-					struct user_beancounter *ub);
-
 void ub_sync_memcg(struct user_beancounter *ub)
 {
 	struct cgroup *cg;
diff --git a/kernel/bc/sys.c b/kernel/bc/sys.c
index 875f05ecad08..096aa978b04e 100644
--- a/kernel/bc/sys.c
+++ b/kernel/bc/sys.c
@@ -99,7 +99,7 @@ long do_setublimit(uid_t uid, unsigned long resource,
 	init_beancounter_precharge(ub, resource);
 	spin_unlock_irqrestore(&ub->ub_lock, flags);
 
-	error = ub_update_mem_cgroup_limits(ub);
+	error = ub_update_memcg(ub);
 
 	put_beancounter(ub);
 out:
-- 
1.7.10.4




More information about the Devel mailing list