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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 4 Nov 2008 19:28:22 +0900
From:	Daisuke Nishimura <nishimura@....nes.nec.co.jp>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
	hugh@...itas.com, taka@...inux.co.jp, nishimura@....nes.nec.co.jp
Subject: Re: [RFC][PATCH 2/5] memcg : handle swap cache

On Tue, 4 Nov 2008 18:04:29 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> On Tue, 4 Nov 2008 17:42:01 +0900
> Daisuke Nishimura <nishimura@....nes.nec.co.jp> wrote:
> 
> > > +#ifdef CONFIG_SWAP
> > > +int mem_cgroup_cache_charge_swapin(struct page *page,
> > > +			struct mm_struct *mm, gfp_t mask)
> > > +{
> > > +	int ret = 0;
> > > +
> > > +	if (mem_cgroup_subsys.disabled)
> > > +		return 0;
> > > +	if (unlikely(!mm))
> > > +		mm = &init_mm;
> > > +
> > > +	ret = mem_cgroup_charge_common(page, mm, mask,
> > > +			MEM_CGROUP_CHARGE_TYPE_SHMEM, NULL);
> > > +	/*
> > > +	 * The page may be dropped from SwapCache because we don't have
> > > +	 * lock_page().This may cause charge-after-uncharge trouble.
> > > +	 * Fix it up here. (the caller have refcnt to this page and
> > > +	 * page itself is guaranteed not to be freed.)
> > > +	 */
> > > +	if (ret && !PageSwapCache(page))
> > > +		mem_cgroup_uncharge_swapcache(page);
> > > +
> > Hmm.. after [5/5], mem_cgroup_cache_charge_swapin has 'locked' parameter,
> > calls lock_page(if !locked), and checks PageSwapCache under page lock.
> > 
> > Why not doing it in this patch?
> > 
> 
> My intention is to guard swap_cgroup by lock_page() against SwapCache.
> In Mem+Swap controller. we get "memcg" from information in page->private.
> I think we need lock_page(), there. 
> 
> But here, we don't refer page->private information. 
> I think we don't need lock_page() because there is no inofrmation we depends on.
> 
I just thought it would be simpler to check PageSwapCache after holding
page lock rather than to handle the case that the page might be removed from
swap cache.

And to be honest, I can't understand the "charge-after-uncharge trouble".
Could you explain more?


Thanks,
Dasiuke 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