All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 5/5] (experimental) chase and free cache only swap
Date: Wed, 27 May 2009 03:26:58 +0200	[thread overview]
Message-ID: <20090527012658.GA9692@cmpxchg.org> (raw)
In-Reply-To: <20090527090813.a0e436f8.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, May 27, 2009 at 09:08:13AM +0900, KAMEZAWA Hiroyuki wrote:
> On Tue, 26 May 2009 20:14:00 +0200
> Johannes Weiner <hannes@cmpxchg.org> wrote:
> 
> > On Tue, May 26, 2009 at 12:18:34PM +0900, KAMEZAWA Hiroyuki wrote:
> > > 
> > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > > 
> > > Just a trial/example patch.
> > > I'd like to consider more. Better implementation idea is welcome.
> > > 
> > > When the system does swap-in/swap-out repeatedly, there are 
> > > cache-only swaps in general.
> > > Typically,
> > >  - swapped out in past but on memory now while vm_swap_full() returns true
> > > pages are cache-only swaps. (swap_map has no references.)
> > > 
> > > This cache-only swaps can be an obstacles for smooth page reclaiming.
> > > Current implemantation is very naive, just scan & free.
> > 
> > I think we can just remove that vm_swap_full() check in do_swap_page()
> > and try to remove the page from swap cache unconditionally.
> > 
> I'm not sure why reclaim swap entry only at write fault.

How do you come to that conclusion?  Do you mean the current code does
that?  Did you understand that I suggested that?

> > If it's still mapped someplace else, we let it cached.  If not, there
> > is not much use for keeping it around and we free it.
> > 
> yes.
> 
> > When I removed it and did benchmarks, I couldn't spot any difference
> > in the timings, though.  Did you measure the benefits of your patch
> > somehow?
> My patche has no "performance benefit". (My patch description may be bad.)
> I just checked that cache-only-swap can be big.(by sysrq-m)
> 
> Even when we remove vm_swap_full() in do_swap_page(),
> swapin-readahead + trylock-at-zap + vmscan makes "unused" swap caches easily.
> It reaches 1M in 2hours test of heavy swap program.

Ouch.

> > According to the git history tree, vm_swap_full() was initially only
> > used to aggressively drop cache entries even when they are mapped.
> > 
> > Rik put it into vmscan to reclaim swap cache _at all_ for activated
> > pages.  But I think unconditionally dropping the cache entry makes
> > sense if the page gets shuffled around on the LRU list.  Better to
> > re-allocate a swap slot close to the new LRU buddies on the next scan.
> > 
> > And having this all covered, the need for the scanning your patch does
> > should be gone, unless I missed something.
> > 
> Considering memcg, global lru scanning is no help ;(
> And I'm writing this patch for memcg.

Oh, sorry.  That makes sense of course.

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 5/5] (experimental) chase and free cache only swap
Date: Wed, 27 May 2009 03:26:58 +0200	[thread overview]
Message-ID: <20090527012658.GA9692@cmpxchg.org> (raw)
In-Reply-To: <20090527090813.a0e436f8.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, May 27, 2009 at 09:08:13AM +0900, KAMEZAWA Hiroyuki wrote:
> On Tue, 26 May 2009 20:14:00 +0200
> Johannes Weiner <hannes@cmpxchg.org> wrote:
> 
> > On Tue, May 26, 2009 at 12:18:34PM +0900, KAMEZAWA Hiroyuki wrote:
> > > 
> > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > > 
> > > Just a trial/example patch.
> > > I'd like to consider more. Better implementation idea is welcome.
> > > 
> > > When the system does swap-in/swap-out repeatedly, there are 
> > > cache-only swaps in general.
> > > Typically,
> > >  - swapped out in past but on memory now while vm_swap_full() returns true
> > > pages are cache-only swaps. (swap_map has no references.)
> > > 
> > > This cache-only swaps can be an obstacles for smooth page reclaiming.
> > > Current implemantation is very naive, just scan & free.
> > 
> > I think we can just remove that vm_swap_full() check in do_swap_page()
> > and try to remove the page from swap cache unconditionally.
> > 
> I'm not sure why reclaim swap entry only at write fault.

How do you come to that conclusion?  Do you mean the current code does
that?  Did you understand that I suggested that?

> > If it's still mapped someplace else, we let it cached.  If not, there
> > is not much use for keeping it around and we free it.
> > 
> yes.
> 
> > When I removed it and did benchmarks, I couldn't spot any difference
> > in the timings, though.  Did you measure the benefits of your patch
> > somehow?
> My patche has no "performance benefit". (My patch description may be bad.)
> I just checked that cache-only-swap can be big.(by sysrq-m)
> 
> Even when we remove vm_swap_full() in do_swap_page(),
> swapin-readahead + trylock-at-zap + vmscan makes "unused" swap caches easily.
> It reaches 1M in 2hours test of heavy swap program.

Ouch.

> > According to the git history tree, vm_swap_full() was initially only
> > used to aggressively drop cache entries even when they are mapped.
> > 
> > Rik put it into vmscan to reclaim swap cache _at all_ for activated
> > pages.  But I think unconditionally dropping the cache entry makes
> > sense if the page gets shuffled around on the LRU list.  Better to
> > re-allocate a swap slot close to the new LRU buddies on the next scan.
> > 
> > And having this all covered, the need for the scanning your patch does
> > should be gone, unless I missed something.
> > 
> Considering memcg, global lru scanning is no help ;(
> And I'm writing this patch for memcg.

Oh, sorry.  That makes sense of course.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-05-27  1:28 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26  3:12 [RFC][PATCH] memcg: fix swap account (26/May)[0/5] KAMEZAWA Hiroyuki
2009-05-26  3:12 ` KAMEZAWA Hiroyuki
2009-05-26  3:14 ` [RFC][PATCH 1/5] change swap cache interfaces KAMEZAWA Hiroyuki
2009-05-26  3:14   ` KAMEZAWA Hiroyuki
2009-05-26  3:15 ` [RFC][PATCH 2/5] add SWAP_HAS_CACHE flag to swap_map KAMEZAWA Hiroyuki
2009-05-26  3:15   ` KAMEZAWA Hiroyuki
2009-05-27  4:02   ` Daisuke Nishimura
2009-05-27  4:02     ` Daisuke Nishimura
2009-05-27  4:36     ` KAMEZAWA Hiroyuki
2009-05-27  4:36       ` KAMEZAWA Hiroyuki
2009-05-27  5:00       ` Daisuke Nishimura
2009-05-27  5:00         ` Daisuke Nishimura
2009-05-28  0:41   ` Daisuke Nishimura
2009-05-28  0:41     ` Daisuke Nishimura
2009-05-28  1:05     ` KAMEZAWA Hiroyuki
2009-05-28  1:05       ` KAMEZAWA Hiroyuki
2009-05-28  1:40       ` Daisuke Nishimura
2009-05-28  1:40         ` Daisuke Nishimura
2009-05-28  1:44         ` KAMEZAWA Hiroyuki
2009-05-28  1:44           ` KAMEZAWA Hiroyuki
2009-05-26  3:16 ` [RFC][PATCH 3/5] count cache-only swaps KAMEZAWA Hiroyuki
2009-05-26  3:16   ` KAMEZAWA Hiroyuki
2009-05-26 17:37   ` Johannes Weiner
2009-05-26 17:37     ` Johannes Weiner
2009-05-26 23:49     ` KAMEZAWA Hiroyuki
2009-05-26 23:49       ` KAMEZAWA Hiroyuki
2009-05-26  3:17 ` [RFC][PATCH 4/5] memcg: fix swap account KAMEZAWA Hiroyuki
2009-05-26  3:17   ` KAMEZAWA Hiroyuki
2009-05-26  3:18 ` [RFC][PATCH 5/5] (experimental) chase and free cache only swap KAMEZAWA Hiroyuki
2009-05-26  3:18   ` KAMEZAWA Hiroyuki
2009-05-26 18:14   ` Johannes Weiner
2009-05-26 18:14     ` Johannes Weiner
2009-05-27  0:08     ` KAMEZAWA Hiroyuki
2009-05-27  0:08       ` KAMEZAWA Hiroyuki
2009-05-27  1:26       ` Johannes Weiner [this message]
2009-05-27  1:26         ` Johannes Weiner
2009-05-27  1:31         ` KAMEZAWA Hiroyuki
2009-05-27  1:31           ` KAMEZAWA Hiroyuki
2009-05-27  2:06           ` Johannes Weiner
2009-05-27  2:06             ` Johannes Weiner
2009-05-27  5:14   ` KAMEZAWA Hiroyuki
2009-05-27  5:14     ` KAMEZAWA Hiroyuki
2009-05-27  6:30     ` Daisuke Nishimura
2009-05-27  6:30       ` Daisuke Nishimura
2009-05-27  6:50       ` KAMEZAWA Hiroyuki
2009-05-27  6:50         ` KAMEZAWA Hiroyuki
2009-05-27  6:43 ` [RFC][PATCH] memcg: fix swap account (26/May)[0/5] KAMEZAWA Hiroyuki
2009-05-27  6:43   ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090527012658.GA9692@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.