Li Zefan 068b38c1fa memcg: fix a race when setting memory.swappiness
(suppose: memcg->use_hierarchy == 0 and memcg->swappiness == 60)

echo 10 > /memcg/0/swappiness   |
  mem_cgroup_swappiness_write() |
    ...                         | echo 1 > /memcg/0/use_hierarchy
                                | mkdir /mnt/0/1
                                |   sub_memcg->swappiness = 60;
    memcg->swappiness = 10;     |

In the above scenario, we end up having 2 different swappiness
values in a single hierarchy.

We should hold cgroup_lock() when cheking cgrp->children list.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-15 16:39:41 -08:00
..
2008-12-29 11:27:46 +02:00
2009-01-06 15:59:14 -08:00
2009-01-06 15:59:08 -08:00
2007-10-20 01:27:18 +02:00
2008-07-28 16:30:21 -07:00
2009-01-08 08:31:07 -08:00
2009-01-08 08:31:05 -08:00
2008-06-12 18:05:41 -07:00
2009-01-01 10:12:29 +10:30
2007-10-20 01:27:18 +02:00
2009-01-08 08:31:10 -08:00
2009-01-01 10:12:29 +10:30
2008-11-30 10:03:35 -08:00
2009-01-08 08:31:05 -08:00
2009-01-08 08:31:08 -08:00
2009-01-01 10:12:29 +10:30