From 6ac253363e2c83ced61768c204597df1de7c0ec8 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Thu, 15 Jan 2009 13:51:26 -0800 Subject: [PATCH] --- yaml --- r: 129699 b: refs/heads/master c: 068b38c1fa7a9210608f27ac521897ccc5f9b726 h: refs/heads/master i: 129697: 7cb62248cbefbe6affe59fde4e3d35dffe7a734e 129695: c504d2def02db00dfa0372879d47310c7d7535f6 v: v3 --- [refs] | 2 +- trunk/mm/memcontrol.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 541bda67133a..7068ae048d11 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0eb253e223c88b982461e59154fcad1b82597592 +refs/heads/master: 068b38c1fa7a9210608f27ac521897ccc5f9b726 diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index f0dc076adf05..4d0ea3ceba6d 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -1992,6 +1992,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft, { struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); struct mem_cgroup *parent; + if (val > 100) return -EINVAL; @@ -1999,15 +2000,22 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft, return -EINVAL; parent = mem_cgroup_from_cont(cgrp->parent); + + cgroup_lock(); + /* If under hierarchy, only empty-root can set this value */ if ((parent->use_hierarchy) || - (memcg->use_hierarchy && !list_empty(&cgrp->children))) + (memcg->use_hierarchy && !list_empty(&cgrp->children))) { + cgroup_unlock(); return -EINVAL; + } spin_lock(&memcg->reclaim_param_lock); memcg->swappiness = val; spin_unlock(&memcg->reclaim_param_lock); + cgroup_unlock(); + return 0; }