All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2014-02-14  4:34 Stephen Rothwell
  2014-02-14  8:33 ` Michal Hocko
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2014-02-14  4:34 UTC (permalink / raw)
  To: Andrew Morton, Tejun Heo; +Cc: linux-next, linux-kernel, Michal Hocko

[-- Attachment #1: Type: text/plain, Size: 2383 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/memcontrol.c between commit e61734c55c24 ("cgroup: remove
cgroup->name") from the cgroup tree and commit 05d3a02a1a0d ("memcg:
change oom_info_lock to mutex") from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc mm/memcontrol.c
index d9c6ac1532e6,de1a2aed4954..000000000000
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@@ -1683,25 -1683,54 +1683,25 @@@ static void move_unlock_mem_cgroup(stru
   */
  void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
  {
 -	/*
 -	 * protects memcg_name and makes sure that parallel ooms do not
 -	 * interleave
 -	 */
 +	/* oom_info_lock ensures that parallel ooms do not interleave */
- 	static DEFINE_SPINLOCK(oom_info_lock);
+ 	static DEFINE_MUTEX(oom_info_lock);
 -	struct cgroup *task_cgrp;
 -	struct cgroup *mem_cgrp;
 -	static char memcg_name[PATH_MAX];
 -	int ret;
  	struct mem_cgroup *iter;
  	unsigned int i;
  
  	if (!p)
  		return;
  
- 	spin_lock(&oom_info_lock);
+ 	mutex_lock(&oom_info_lock);
  	rcu_read_lock();
  
 -	mem_cgrp = memcg->css.cgroup;
 -	task_cgrp = task_cgroup(p, mem_cgroup_subsys_id);
 -
 -	ret = cgroup_path(task_cgrp, memcg_name, PATH_MAX);
 -	if (ret < 0) {
 -		/*
 -		 * Unfortunately, we are unable to convert to a useful name
 -		 * But we'll still print out the usage information
 -		 */
 -		rcu_read_unlock();
 -		goto done;
 -	}
 -	rcu_read_unlock();
 -
 -	pr_info("Task in %s killed", memcg_name);
 +	pr_info("Task in ");
 +	pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id));
 +	pr_info(" killed as a result of limit of ");
 +	pr_cont_cgroup_path(memcg->css.cgroup);
 +	pr_info("\n");
  
 -	rcu_read_lock();
 -	ret = cgroup_path(mem_cgrp, memcg_name, PATH_MAX);
 -	if (ret < 0) {
 -		rcu_read_unlock();
 -		goto done;
 -	}
  	rcu_read_unlock();
  
 -	/*
 -	 * Continues from above, so we don't need an KERN_ level
 -	 */
 -	pr_cont(" as a result of limit of %s\n", memcg_name);
 -done:
 -
  	pr_info("memory: usage %llukB, limit %llukB, failcnt %llu\n",
  		res_counter_read_u64(&memcg->res, RES_USAGE) >> 10,
  		res_counter_read_u64(&memcg->res, RES_LIMIT) >> 10,

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux-next: manual merge of the akpm-current tree with the cgroup tree
  2014-02-14  4:34 linux-next: manual merge of the akpm-current tree with the cgroup tree Stephen Rothwell
@ 2014-02-14  8:33 ` Michal Hocko
  2014-02-14  8:57   ` Michal Hocko
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Hocko @ 2014-02-14  8:33 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Andrew Morton, Tejun Heo, linux-next, linux-kernel

On Fri 14-02-14 15:34:14, Stephen Rothwell wrote:
[...]
> diff --cc mm/memcontrol.c
> index d9c6ac1532e6,de1a2aed4954..000000000000
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@@ -1683,25 -1683,54 +1683,25 @@@ static void move_unlock_mem_cgroup(stru
>    */
>   void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
>   {
>  -	/*
>  -	 * protects memcg_name and makes sure that parallel ooms do not
>  -	 * interleave
>  -	 */
>  +	/* oom_info_lock ensures that parallel ooms do not interleave */
> - 	static DEFINE_SPINLOCK(oom_info_lock);
> + 	static DEFINE_MUTEX(oom_info_lock);
>  -	struct cgroup *task_cgrp;
>  -	struct cgroup *mem_cgrp;
>  -	static char memcg_name[PATH_MAX];
>  -	int ret;
>   	struct mem_cgroup *iter;
>   	unsigned int i;
>   
>   	if (!p)
>   		return;
>   
> - 	spin_lock(&oom_info_lock);
> + 	mutex_lock(&oom_info_lock);
>   	rcu_read_lock();
>   
>  -	mem_cgrp = memcg->css.cgroup;
>  -	task_cgrp = task_cgroup(p, mem_cgroup_subsys_id);
>  -
>  -	ret = cgroup_path(task_cgrp, memcg_name, PATH_MAX);
>  -	if (ret < 0) {
>  -		/*
>  -		 * Unfortunately, we are unable to convert to a useful name
>  -		 * But we'll still print out the usage information
>  -		 */
>  -		rcu_read_unlock();
>  -		goto done;
>  -	}
>  -	rcu_read_unlock();
>  -
>  -	pr_info("Task in %s killed", memcg_name);
>  +	pr_info("Task in ");
>  +	pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id));
>  +	pr_info(" killed as a result of limit of ");
>  +	pr_cont_cgroup_path(memcg->css.cgroup);
>  +	pr_info("\n");
>   
>  -	rcu_read_lock();
>  -	ret = cgroup_path(mem_cgrp, memcg_name, PATH_MAX);
>  -	if (ret < 0) {
>  -		rcu_read_unlock();
>  -		goto done;
>  -	}
>   	rcu_read_unlock();
>   
>  -	/*
>  -	 * Continues from above, so we don't need an KERN_ level
>  -	 */
>  -	pr_cont(" as a result of limit of %s\n", memcg_name);
>  -done:
>  -
>   	pr_info("memory: usage %llukB, limit %llukB, failcnt %llu\n",
>   		res_counter_read_u64(&memcg->res, RES_USAGE) >> 10,
>   		res_counter_read_u64(&memcg->res, RES_LIMIT) >> 10,

I do not see spin_unlock -> mutex_unlock at the very end of this function.


-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux-next: manual merge of the akpm-current tree with the cgroup tree
  2014-02-14  8:33 ` Michal Hocko
@ 2014-02-14  8:57   ` Michal Hocko
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Hocko @ 2014-02-14  8:57 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Andrew Morton, Tejun Heo, linux-next, linux-kernel

On Fri 14-02-14 09:33:45, Michal Hocko wrote:
[...]
> I do not see spin_unlock -> mutex_unlock at the very end of this function.

Scratch that. That part apparently didn't conflict so it wasn't in the
merge commit. Sorry about the noise
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2015-08-19  8:43 Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2015-08-19  8:43 UTC (permalink / raw)
  To: Andrew Morton, Tejun Heo; +Cc: linux-next, linux-kernel, Kees Cook

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in:

  kernel/cgroup.c

between commit:

  d98817d4961b ("cgroup: don't print subsystems for the default hierarchy")
  3e1d2eed39d8 ("cgroup: introduce cgroup_subsys->legacy_name")

from the cgroup tree and commit:

  04b6d1bfdd24 ("fs: create and use seq_show_option for escaping")

from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc kernel/cgroup.c
index f3f5cd5e2c0d,c6c4240e7d28..000000000000
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@@ -1339,10 -1332,9 +1339,10 @@@ static int cgroup_show_options(struct s
  	struct cgroup_subsys *ss;
  	int ssid;
  
 -	for_each_subsys(ss, ssid)
 -		if (root->subsys_mask & (1 << ssid))
 -			seq_show_option(seq, ss->name, NULL);
 +	if (root != &cgrp_dfl_root)
 +		for_each_subsys(ss, ssid)
 +			if (root->subsys_mask & (1 << ssid))
- 				seq_printf(seq, ",%s", ss->legacy_name);
++				seq_show_option(seq, ss->legacy_name, NULL);
  	if (root->flags & CGRP_ROOT_NOPREFIX)
  		seq_puts(seq, ",noprefix");
  	if (root->flags & CGRP_ROOT_XATTR)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2014-05-14  7:22 Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2014-05-14  7:22 UTC (permalink / raw)
  To: Andrew Morton, Tejun Heo; +Cc: linux-next, linux-kernel, Michal Hocko

[-- Attachment #1: Type: text/plain, Size: 3132 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/memcontrol.c between commit 6770c64e5c8d ("cgroup: replace
cftype->trigger() with cftype->write()") from the cgroup tree and
commits 15aa061d2994 ("memcg: deprecate memory.force_empty knob") and
2423e4fd8967 ("memcg-deprecate-memoryforce_empty-knob-fix") from the
akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc mm/memcontrol.c
index 66447745d0c0,2cb81478d30c..000000000000
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@@ -833,9 -829,9 +826,9 @@@ retry
  	 * we will to add it back at the end of reclaim to its correct
  	 * position in the tree.
  	 */
- 	__mem_cgroup_remove_exceeded(mz->memcg, mz, mctz);
+ 	__mem_cgroup_remove_exceeded(mz, mctz);
  	if (!res_counter_soft_limit_excess(&mz->memcg->res) ||
 -		!css_tryget(&mz->memcg->css))
 +	    !css_tryget_online(&mz->memcg->css))
  		goto retry;
  done:
  	return mz;
@@@ -4895,7 -4795,11 +4794,11 @@@ static ssize_t mem_cgroup_force_empty_w
  
  	if (mem_cgroup_is_root(memcg))
  		return -EINVAL;
+ 	pr_info_once("%s (%d): memory.force_empty is deprecated and will be "
+ 		     "removed.  Let us know if it is needed in your usecase at "
+ 		     "linux-mm@kvack.org\n",
+ 		     current->comm, task_pid_nr(current));
 -	return mem_cgroup_force_empty(memcg);
 +	return mem_cgroup_force_empty(memcg) ?: nbytes;
  }
  
  static u64 mem_cgroup_hierarchy_read(struct cgroup_subsys_state *css,
@@@ -5176,8 -5080,26 +5080,26 @@@ static ssize_t mem_cgroup_write(struct 
  		else
  			return -EINVAL;
  		break;
+ 	case RES_LOW_LIMIT:
+ 		if (mem_cgroup_is_root(memcg)) { /* Can't set limit on root */
+ 			ret = -EINVAL;
+ 			break;
+ 		}
+ 		ret = res_counter_memparse_write_strategy(buffer, &val);
+ 		if (ret)
+ 			break;
+ 		if (type == _MEM) {
+ 			ret = res_counter_set_low_limit(&memcg->res, val);
+ 			break;
+ 		}
+ 		/*
+ 		 * memsw low limit doesn't make any sense and kmem is not
+ 		 * implemented yet - if ever
+ 		 */
+ 		return -EINVAL;
+ 
  	case RES_SOFT_LIMIT:
 -		ret = res_counter_memparse_write_strategy(buffer, &val);
 +		ret = res_counter_memparse_write_strategy(buf, &val);
  		if (ret)
  			break;
  		/*
@@@ -6117,9 -6020,15 +6024,15 @@@ static struct cftype mem_cgroup_files[
  		.read_u64 = mem_cgroup_read_u64,
  	},
  	{
+ 		.name = "low_limit_in_bytes",
+ 		.private = MEMFILE_PRIVATE(_MEM, RES_LOW_LIMIT),
+ 		.write_string = mem_cgroup_write,
+ 		.read_u64 = mem_cgroup_read_u64,
+ 	},
+ 	{
  		.name = "soft_limit_in_bytes",
  		.private = MEMFILE_PRIVATE(_MEM, RES_SOFT_LIMIT),
 -		.write_string = mem_cgroup_write,
 +		.write = mem_cgroup_write,
  		.read_u64 = mem_cgroup_read_u64,
  	},
  	{
@@@ -6134,7 -6043,8 +6047,8 @@@
  	},
  	{
  		.name = "force_empty",
+ 		.flags = CFTYPE_INSANE,
 -		.trigger = mem_cgroup_force_empty_write,
 +		.write = mem_cgroup_force_empty_write,
  	},
  	{
  		.name = "use_hierarchy",

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2014-02-26  7:43 Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2014-02-26  7:43 UTC (permalink / raw)
  To: Andrew Morton, Tejun Heo
  Cc: linux-next, linux-kernel, Michal Hocko, Vladimir Davydov

[-- Attachment #1: Type: text/plain, Size: 2449 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/memcontrol.c between commits e61734c55c24 ("cgroup: remove
cgroup->name") from the cgroup tree and commits a89db06ab1b4 ("memcg:
change oom_info_lock to mutex") and c78e84121972 ("memcg, slab: cleanup
memcg cache creation") from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc mm/memcontrol.c
index d9c6ac1532e6,452f45087566..000000000000
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@@ -1683,25 -1683,54 +1683,25 @@@ static void move_unlock_mem_cgroup(stru
   */
  void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
  {
 -	/*
 -	 * protects memcg_name and makes sure that parallel ooms do not
 -	 * interleave
 -	 */
 +	/* oom_info_lock ensures that parallel ooms do not interleave */
- 	static DEFINE_SPINLOCK(oom_info_lock);
+ 	static DEFINE_MUTEX(oom_info_lock);
 -	struct cgroup *task_cgrp;
 -	struct cgroup *mem_cgrp;
 -	static char memcg_name[PATH_MAX];
 -	int ret;
  	struct mem_cgroup *iter;
  	unsigned int i;
  
  	if (!p)
  		return;
  
- 	spin_lock(&oom_info_lock);
+ 	mutex_lock(&oom_info_lock);
  	rcu_read_lock();
  
 -	mem_cgrp = memcg->css.cgroup;
 -	task_cgrp = task_cgroup(p, mem_cgroup_subsys_id);
 +	pr_info("Task in ");
 +	pr_cont_cgroup_path(task_cgroup(p, memory_cgrp_id));
 +	pr_info(" killed as a result of limit of ");
 +	pr_cont_cgroup_path(memcg->css.cgroup);
 +	pr_info("\n");
  
 -	ret = cgroup_path(task_cgrp, memcg_name, PATH_MAX);
 -	if (ret < 0) {
 -		/*
 -		 * Unfortunately, we are unable to convert to a useful name
 -		 * But we'll still print out the usage information
 -		 */
 -		rcu_read_unlock();
 -		goto done;
 -	}
  	rcu_read_unlock();
  
 -	pr_info("Task in %s killed", memcg_name);
 -
 -	rcu_read_lock();
 -	ret = cgroup_path(mem_cgrp, memcg_name, PATH_MAX);
 -	if (ret < 0) {
 -		rcu_read_unlock();
 -		goto done;
 -	}
 -	rcu_read_unlock();
 -
 -	/*
 -	 * Continues from above, so we don't need an KERN_ level
 -	 */
 -	pr_cont(" as a result of limit of %s\n", memcg_name);
 -done:
 -
  	pr_info("memory: usage %llukB, limit %llukB, failcnt %llu\n",
  		res_counter_read_u64(&memcg->res, RES_USAGE) >> 10,
  		res_counter_read_u64(&memcg->res, RES_LIMIT) >> 10,

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: linux-next: manual merge of the akpm-current tree with the cgroup tree
  2014-02-14  4:25 Stephen Rothwell
@ 2014-02-14  4:30 ` Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2014-02-14  4:30 UTC (permalink / raw)
  To: Andrew Morton, Tejun Heo; +Cc: linux-next, linux-kernel, Viresh Kumar

[-- Attachment #1: Type: text/plain, Size: 755 bytes --]

[Just adding Tejun]

On Fri, 14 Feb 2014 15:25:57 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi Andrew,
> 
> Today's linux-next merge of the akpm-current tree got a conflict in
> kernel/cpuset.c between commit d66393e54e0a ("cpuset: use
> css_task_iter_start/next/end() instead of css_scan_tasks()") from the
> cgroup tree and commit a82211b06d6e ("cpusets: allocate heap only when
> required") from the akpm-current tree.
> 
> I fixed it up (the former removed the need for the heap, so I effectively
> remove the latter) and can carry the fix as necessary (no action is
> required).
> 
> -- 
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au


-- 
Cheers,
Stephen Rothwell <sfr@canb.auug.org.au>

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2014-02-14  4:25 Stephen Rothwell
  2014-02-14  4:30 ` Stephen Rothwell
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2014-02-14  4:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-next, linux-kernel, Viresh Kumar

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
kernel/cpuset.c between commit d66393e54e0a ("cpuset: use
css_task_iter_start/next/end() instead of css_scan_tasks()") from the
cgroup tree and commit a82211b06d6e ("cpusets: allocate heap only when
required") from the akpm-current tree.

I fixed it up (the former removed the need for the heap, so I effectively
remove the latter) and can carry the fix as necessary (no action is
required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2013-09-25  3:57 Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2013-09-25  3:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-next, linux-kernel, Li Zefan, Tejun Heo

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/memcontrol.c between commit b86278359484 ("memcg: stop using css id")
from the cgroup tree and commit 4c34cae8f277 ("revert "memcg: get rid of
soft-limit tree infrastructure"") from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc mm/memcontrol.c
index 65a46ef,7dda769..0000000
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@@ -5979,6 -6196,9 +6209,8 @@@ static void __mem_cgroup_free(struct me
  	int node;
  	size_t size = memcg_size();
  
+ 	mem_cgroup_remove_from_trees(memcg);
 -	free_css_id(&mem_cgroup_subsys, &memcg->css);
+ 
  	for_each_node(node)
  		free_mem_cgroup_per_zone_info(memcg, node);
  

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* linux-next: manual merge of the akpm-current tree with the cgroup tree
@ 2013-08-12  6:07 Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2013-08-12  6:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-next, linux-kernel, Tejun Heo, Michal Hocko, Li Zefan

[-- Attachment #1: Type: text/plain, Size: 5671 bytes --]

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
mm/memcontrol.c between commits from the cgroup tree and commits from the
akpm-current tree.

I fixed it up (using Michal's email as a guide - see below) and can carry
the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc mm/memcontrol.c
index 57f6d67,6f292b8..0000000
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@@ -1075,13 -966,30 +959,13 @@@ mem_cgroup_filter(struct mem_cgroup *me
   * helper function to be used by mem_cgroup_iter
   */
  static struct mem_cgroup *__mem_cgroup_iter_next(struct mem_cgroup *root,
- 		struct mem_cgroup *last_visited)
+ 		struct mem_cgroup *last_visited, mem_cgroup_iter_filter cond)
  {
 -	struct cgroup *prev_cgroup, *next_cgroup;
 -
 -	/*
 -	 * Root is not visited by cgroup iterators so it needs an
 -	 * explicit visit.
 -	 */
 -	if (!last_visited) {
 -		switch (mem_cgroup_filter(root, root, cond)) {
 -		case VISIT:
 -			return root;
 -		case SKIP:
 -			break;
 -		case SKIP_TREE:
 -			return NULL;
 -		}
 -	}
 +	struct cgroup_subsys_state *prev_css, *next_css;
  
 -	prev_cgroup = (last_visited == root || !last_visited) ? NULL
 -		: last_visited->css.cgroup;
 +	prev_css = last_visited ? &last_visited->css : NULL;
  skip_node:
 -	next_cgroup = cgroup_next_descendant_pre(
 -			prev_cgroup, root->css.cgroup);
 +	next_css = css_next_descendant_pre(prev_css, &root->css);
  
  	/*
  	 * Even if we found a group we have to make sure it is
@@@ -1090,14 -998,33 +974,34 @@@
  	 * last_visited css is safe to use because it is
  	 * protected by css_get and the tree walk is rcu safe.
  	 */
 -	if (next_cgroup) {
 -		struct mem_cgroup *mem = mem_cgroup_from_cont(
 -				next_cgroup);
 +	if (next_css) {
 +		struct mem_cgroup *mem = mem_cgroup_from_css(next_css);
  
- 		if (css_tryget(&mem->css))
- 			return mem;
- 		else {
- 			prev_css = next_css;
+ 		switch (mem_cgroup_filter(mem, root, cond)) {
+ 		case SKIP:
+ 			prev_cgroup = next_cgroup;
  			goto skip_node;
+ 		case SKIP_TREE:
++			if (mem == root)
++				return NULL;
+ 			/*
+ 			 * cgroup_rightmost_descendant is not an optimal way to
+ 			 * skip through a subtree (especially for imbalanced
+ 			 * trees leaning to right) but that's what we have right
+ 			 * now. More effective solution would be traversing
+ 			 * right-up for first non-NULL without calling
+ 			 * cgroup_next_descendant_pre afterwards.
+ 			 */
 -			prev_cgroup = cgroup_rightmost_descendant(next_cgroup);
++			prev_css = css_rightmost_descendant(next_css);
+ 			goto skip_node;
+ 		case VISIT:
+ 			if (css_tryget(&mem->css))
+ 				return mem;
+ 			else {
+ 				prev_cgroup = next_cgroup;
+ 				goto skip_node;
+ 			}
+ 			break;
  		}
  	}
  
@@@ -4983,11 -4841,9 +4815,10 @@@ static int mem_cgroup_force_empty(struc
  	return 0;
  }
  
 -static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event)
 +static int mem_cgroup_force_empty_write(struct cgroup_subsys_state *css,
 +					unsigned int event)
  {
 -	struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
 +	struct mem_cgroup *memcg = mem_cgroup_from_css(css);
- 	int ret;
  
  	if (mem_cgroup_is_root(memcg))
  		return -EINVAL;
@@@ -5136,8 -4991,8 +4963,8 @@@ static int memcg_update_kmem_limit(stru
  	 */
  	mutex_lock(&memcg_create_mutex);
  	mutex_lock(&set_limit_mutex);
- 	if (!memcg->kmem_account_flags && val != RESOURCE_MAX) {
+ 	if (!memcg->kmem_account_flags && val != RES_COUNTER_MAX) {
 -		if (cgroup_task_count(cont) || memcg_has_children(memcg)) {
 +		if (cgroup_task_count(css->cgroup) || memcg_has_children(memcg)) {
  			ret = -EBUSY;
  			goto out;
  		}
@@@ -6174,31 -6035,8 +5998,8 @@@ struct mem_cgroup *parent_mem_cgroup(st
  }
  EXPORT_SYMBOL(parent_mem_cgroup);
  
- static void __init mem_cgroup_soft_limit_tree_init(void)
- {
- 	struct mem_cgroup_tree_per_node *rtpn;
- 	struct mem_cgroup_tree_per_zone *rtpz;
- 	int tmp, node, zone;
- 
- 	for_each_node(node) {
- 		tmp = node;
- 		if (!node_state(node, N_NORMAL_MEMORY))
- 			tmp = -1;
- 		rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, tmp);
- 		BUG_ON(!rtpn);
- 
- 		soft_limit_tree.rb_tree_per_node[node] = rtpn;
- 
- 		for (zone = 0; zone < MAX_NR_ZONES; zone++) {
- 			rtpz = &rtpn->rb_tree_per_zone[zone];
- 			rtpz->rb_root = RB_ROOT;
- 			spin_lock_init(&rtpz->lock);
- 		}
- 	}
- }
- 
  static struct cgroup_subsys_state * __ref
 -mem_cgroup_css_alloc(struct cgroup *cont)
 +mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
  {
  	struct mem_cgroup *memcg;
  	long error = -ENOMEM;
@@@ -6295,14 -6135,21 +6097,23 @@@ static void mem_cgroup_invalidate_recla
  		mem_cgroup_iter_invalidate(root_mem_cgroup);
  }
  
 -static void mem_cgroup_css_offline(struct cgroup *cont)
 +static void mem_cgroup_css_offline(struct cgroup_subsys_state *css)
  {
 -	struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
 +	struct mem_cgroup *memcg = mem_cgroup_from_css(css);
 +
 +	kmem_cgroup_css_offline(memcg);
  
+ 	kmem_cgroup_css_offline(memcg);
+ 
  	mem_cgroup_invalidate_reclaim_iterators(memcg);
  	mem_cgroup_reparent_charges(memcg);
+ 	if (memcg->soft_contributed) {
+ 		while ((memcg = parent_mem_cgroup(memcg)))
+ 			atomic_dec(&memcg->children_in_excess);
+ 
+ 		if (memcg != root_mem_cgroup && !root_mem_cgroup->use_hierarchy)
+ 			atomic_dec(&root_mem_cgroup->children_in_excess);
+ 	}
  	mem_cgroup_destroy_all_caches(memcg);
  	vmpressure_cleanup(&memcg->vmpressure);
  }

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-08-19  8:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  4:34 linux-next: manual merge of the akpm-current tree with the cgroup tree Stephen Rothwell
2014-02-14  8:33 ` Michal Hocko
2014-02-14  8:57   ` Michal Hocko
  -- strict thread matches above, loose matches on Subject: below --
2015-08-19  8:43 Stephen Rothwell
2014-05-14  7:22 Stephen Rothwell
2014-02-26  7:43 Stephen Rothwell
2014-02-14  4:25 Stephen Rothwell
2014-02-14  4:30 ` Stephen Rothwell
2013-09-25  3:57 Stephen Rothwell
2013-08-12  6:07 Stephen Rothwell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.