[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e97d260eecc1a5f01a900996ae12cc265b6023c7.1404383187.git.vdavydov@parallels.com>
Date: Thu, 3 Jul 2014 16:48:21 +0400
From: Vladimir Davydov <vdavydov@...allels.com>
To: <linux-kernel@...r.kernel.org>
CC: <linux-mm@...ck.org>, <cgroups@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...e.cz>, Mel Gorman <mgorman@...e.de>,
Rik van Riel <riel@...hat.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Hugh Dickins <hughd@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Pavel Emelyanov <xemul@...allels.com>,
Balbir Singh <bsingharora@...il.com>
Subject: [PATCH RFC 5/5] vm_cgroup: do not charge tasks in root cgroup
For the root cgroup (the whole system), we already have overcommit
accounting and control, so we can skip charging tasks in the root cgroup
to avoid overhead.
Signed-off-by: Vladimir Davydov <vdavydov@...allels.com>
---
mm/vm_cgroup.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/vm_cgroup.c b/mm/vm_cgroup.c
index 6642f934540a..c871fecaab4c 100644
--- a/mm/vm_cgroup.c
+++ b/mm/vm_cgroup.c
@@ -1,6 +1,7 @@
#include <linux/cgroup.h>
#include <linux/res_counter.h>
#include <linux/mm.h>
+#include <linux/mman.h>
#include <linux/slab.h>
#include <linux/rcupdate.h>
#include <linux/shmem_fs.h>
@@ -65,6 +66,9 @@ static int vm_cgroup_do_charge(struct vm_cgroup *vmcg,
unsigned long val = nr_pages << PAGE_SHIFT;
struct res_counter *fail_res;
+ if (vm_cgroup_is_root(vmcg))
+ return 0;
+
return res_counter_charge(&vmcg->res, val, &fail_res);
}
@@ -73,6 +77,9 @@ static void vm_cgroup_do_uncharge(struct vm_cgroup *vmcg,
{
unsigned long val = nr_pages << PAGE_SHIFT;
+ if (vm_cgroup_is_root(vmcg))
+ return;
+
res_counter_uncharge(&vmcg->res, val);
}
@@ -159,6 +166,9 @@ static u64 vm_cgroup_read_u64(struct cgroup_subsys_state *css,
struct vm_cgroup *vmcg = vm_cgroup_from_css(css);
int memb = cft->private;
+ if (vm_cgroup_is_root(vmcg))
+ return vm_memory_committed() << PAGE_SHIFT;
+
return res_counter_read_u64(&vmcg->res, memb);
}
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists