linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: "nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>
Subject: [RFC][PATCH 0/3] fix memcg to do swap account in right way (avoid swap account leak)
Date: Fri, 22 May 2009 16:57:30 +0900	[thread overview]
Message-ID: <20090522165730.8791c2dd.kamezawa.hiroyu@jp.fujitsu.com> (raw)

Thank you all for comments to previous patches. This is new one.
(Please see when you have free time, I don't want to annoy anyone ;)

Major difference of this version to old ones is
 - old ones tries to fix swap handling itself...
 - this one tries to fix memcg's swap accounting.

I like ideas in this patch set. (But I may need more tests.)

Major concept of this patch set for fixing mis-accounting of memcg is
"ignore a ref from swapcache when we uncharge swap."

Consists of following 3 patches. Maybe patch 1/3 can be a concern for people who
don't use memcg.

 [1/3] Adding SWAP_HAS_CACHE flag to swap_map[] array.
 Add an flag to indicate "there is swap cache" instead of "refcnt from swapcache"
 By this, we'll be able to know refcnt to swap without find_get_page(swapper_space).

 [2/3] fix memcg to handle refcnt to swap.
 There is an issue that "all swap references gone but it can't be freed/uncharged
 because its swapcache is not on memcg's LRU".
 To fix this, this patch tries to unaccount swap even if there is swap-cache.
 Need careful tests (and some fix) but I think this is a good way to go.

 This patch uncharge swap account but swp_entry is still used by swap-cache.
 So, some more work to reclaim unnecesary swap-cache will be required (at vm_swap_full())

 [3/3] count # of swap caches with "unused swp_entries".
 This patch just counts # of swap caches whose swp_entry has no reference.
 This counter + vm_swap_full() will allow us to write a function to reclaim
 swp_entry which is unused.

Any comments are welcome.

Thanks,
-Kame

--
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-22  7:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22  7:57 KAMEZAWA Hiroyuki [this message]
2009-05-22  8:01 ` [RFC][PATCH 1/3] add SWAP_HAS_CACHE flag to swapmap KAMEZAWA Hiroyuki
2009-05-22  8:04 ` [RFC][PATCH 2/3] fix memcg swap account to handle swap ref itself KAMEZAWA Hiroyuki
2009-05-22  8:05 ` [RFC][PATCH 3/3] count swap caches whose swp_entry can be freed 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=20090522165730.8791c2dd.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hugh.dickins@tiscali.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox