Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 129699
b: refs/heads/master
c: 068b38c
h: refs/heads/master
i:
  129697: 7cb6224
  129695: c504d2d
v: v3
  • Loading branch information
Li Zefan authored and Linus Torvalds committed Jan 16, 2009
1 parent 772563e commit 6ac2533
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0eb253e223c88b982461e59154fcad1b82597592
refs/heads/master: 068b38c1fa7a9210608f27ac521897ccc5f9b726
10 changes: 9 additions & 1 deletion trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1992,22 +1992,30 @@ 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;

if (cgrp->parent == NULL)
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;
}

Expand Down

0 comments on commit 6ac2533

Please sign in to comment.