linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
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>,
	"xemul@openvz.org" <xemul@openvz.org>,
	"yamamoto@valinux.co.jp" <yamamoto@valinux.co.jp>,
	lizf@cn.fujitsu.com, Hugh Dickins <hugh@veritas.com>,
	"IKEDA, Munehiro" <m-ikeda@ds.jp.nec.com>
Subject: Re: [RFC][PATCH 3/3] account swapcache
Date: Fri, 11 Apr 2008 21:20:55 +0900	[thread overview]
Message-ID: <47FF57A7.5000704@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20080408191311.73b167bb.kamezawa.hiroyu@jp.fujitsu.com>

Hi, KAMEZAWA-san.

KAMEZAWA Hiroyuki wrote:
> Now swapcache is not accounted. (because it had some troubles.)
> 
> This is retrying account swap cache, based on remove-refcnt patch.
> 
> This does.
>  * When a page is swap-cache,  mem_cgroup_uncharge_page() will *not*
>    uncharge page even if page->mapcount == 0.
>  * When a page is removed from swap-cache, mem_cgroup_uncharge_page()
>    is called again.
>  * A swapcache page is newly charged only when it's mapped.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 

I agree with the idea that swap caches should be charged as memory.
(I think they may be charged as swap at the same time.)

IMO, not charging swap caches as memory occasionally causes a problem
that swap caches are not freed even when a process that owns
those pages try to free them(e.g. task exit).

For example:

  Some pages are being reclaimed via memcg memory reclaim.

  Assume that shrink_page_list() has already moved those pages
  to swap cache, unmapped them from ptes, removed from mz->lru,
  and is working on other pages on page_list.
  Those swap cache pages are unlocked and
  page_count of them are 2(swap cache, isolate_page).

  At the same time on other CPU, if the process that owns those
  pages are trying to free them, free_swap_and_cache() cannot
  free those pages unless vm_swap_full, because find_get_pages()
  increases page_count.

I think this rare case itself also exists on global memory reclaim,
but global memory reclaim does not assume that those pases have
been freed, so, if it need to free more memory, those pases
will be freed later because they remain on global inactive list.

The problem here is that those swap cache pages are uncharged
from memcg, so memcg can never reclaim those pages that belonged
to the group.


Thanks,
Daisuke Nishimura.

--
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>

  parent reply	other threads:[~2008-04-11 12:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080408190734.70ab55b0.kamezawa.hiroyu@jp.fujitsu.com>
2008-04-11  4:57 ` [RFC][PATCH 0/3] memcg: remove refcnt Balbir Singh
     [not found] ` <20080408191311.73b167bb.kamezawa.hiroyu@jp.fujitsu.com>
2008-04-11 12:20   ` Daisuke Nishimura [this message]
2008-04-14  0:47     ` [RFC][PATCH 3/3] account swapcache KAMEZAWA Hiroyuki
2008-04-14  8:03       ` Daisuke Nishimura
2008-04-14  8:23         ` KAMEZAWA Hiroyuki
2008-04-14  8:36           ` Daisuke Nishimura
2008-04-14  8:45             ` 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=47FF57A7.5000704@mxp.nes.nec.co.jp \
    --to=nishimura@mxp.nes.nec.co.jp \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=hugh@veritas.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=m-ikeda@ds.jp.nec.com \
    --cc=xemul@openvz.org \
    --cc=yamamoto@valinux.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