lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100929230252.f593abb1.d-nishimura@mtf.biglobe.ne.jp>
Date:	Wed, 29 Sep 2010 23:02:52 +0900
From:	Daisuke Nishimura <d-nishimura@....biglobe.ne.jp>
To:	"Kirill A. Shutsemov" <kirill@...temov.name>
Cc:	linux-mm@...ck.org, Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [BUGFIX][PATCH] memcg: fix thresholds with use_hierarchy == 1

On Wed, 29 Sep 2010 15:27:25 +0300
"Kirill A. Shutsemov" <kirill@...temov.name> wrote:

> From: Kirill A. Shutemov <kirill@...temov.name>
> 
> We need to check parent's thresholds if parent has use_hierarchy == 1 to
> be sure that parent's threshold events will be triggered even if parent
> itself is not active (no MEM_CGROUP_EVENTS).
> 
> Signed-off-by: Kirill A. Shutemov <kirill@...temov.name>
> ---
>  mm/memcontrol.c |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3eed583..196f710 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3587,9 +3587,20 @@ unlock:
>  
>  static void mem_cgroup_threshold(struct mem_cgroup *memcg)
>  {
> -	__mem_cgroup_threshold(memcg, false);
> -	if (do_swap_account)
> -		__mem_cgroup_threshold(memcg, true);
> +	struct cgroup *parent;
> +
> +	while (1) {
> +		__mem_cgroup_threshold(memcg, false);
> +		if (do_swap_account)
> +			__mem_cgroup_threshold(memcg, true);
> +
> +		parent = memcg->css.cgroup->parent;
> +		if (!parent)
> +			break;
> +		memcg = mem_cgroup_from_cont(parent);
> +		if (!memcg->use_hierarchy)
> +			break;
> +	}
I think you can simplify this part by using parent_mem_cgroup() like:

	parent = parent_mem_cgroup(memcg);
	if (!memcg)
		break;

Thanks,
Daisuke Nishimura.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ