All of lore.kernel.org
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: nishimura@mxp.nes.nec.co.jp,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"hugh@veritas.com" <hugh@veritas.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fix leak of swap accounting as stale swap cache under  memcg
Date: Tue, 28 Apr 2009 08:57:53 +0900	[thread overview]
Message-ID: <20090428085753.a91b6007.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <661de9470904271217t7ef9e300x1e40bbf0362ca14f@mail.gmail.com>

On Tue, 28 Apr 2009 00:47:31 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> Thanks for the detailed explanation of the possible race conditions. I
> am beginning to wonder why we don't have any hooks in add_to_swap.*.
> for charging a page. If the page is already charged and if it is a
> context issue (charging it to the right cgroup) that is already
> handled from what I see. Won't that help us solve the !PageCgroupUsed
> issue?
> 

For adding hook to add_to_swap_cache, we need to know which cgroup the swap cache
should be charged. Then, we have to remove CONFIG_CGROUP_MEM_RES_CTRL_SWAP_EXT
and enable memsw control always.

When using swap_cgroup, we'll know which cgroup the new swap cache should be charged.
Then, the new page readed in will be charged to recorded cgroup in swap_cgroup.
One bad thing of this method is a cgroup which swap_cgroup point to is different from
a cgroup which the task calls do_swap_fault(). This means that a page-fault by a
task can cause memory-reclaim under another cgroup and moreover, OOM.
I don't think it's sane behavior. So, current design of swap accounting waits until the
page is mapped.

Thanks,
-Kame


WARNING: multiple messages have this Message-ID (diff)
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: nishimura@mxp.nes.nec.co.jp,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"hugh@veritas.com" <hugh@veritas.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fix leak of swap accounting as stale swap cache under memcg
Date: Tue, 28 Apr 2009 08:57:53 +0900	[thread overview]
Message-ID: <20090428085753.a91b6007.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <661de9470904271217t7ef9e300x1e40bbf0362ca14f@mail.gmail.com>

On Tue, 28 Apr 2009 00:47:31 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> Thanks for the detailed explanation of the possible race conditions. I
> am beginning to wonder why we don't have any hooks in add_to_swap.*.
> for charging a page. If the page is already charged and if it is a
> context issue (charging it to the right cgroup) that is already
> handled from what I see. Won't that help us solve the !PageCgroupUsed
> issue?
> 

For adding hook to add_to_swap_cache, we need to know which cgroup the swap cache
should be charged. Then, we have to remove CONFIG_CGROUP_MEM_RES_CTRL_SWAP_EXT
and enable memsw control always.

When using swap_cgroup, we'll know which cgroup the new swap cache should be charged.
Then, the new page readed in will be charged to recorded cgroup in swap_cgroup.
One bad thing of this method is a cgroup which swap_cgroup point to is different from
a cgroup which the task calls do_swap_fault(). This means that a page-fault by a
task can cause memory-reclaim under another cgroup and moreover, OOM.
I don't think it's sane behavior. So, current design of swap accounting waits until the
page is mapped.

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-04-27 23:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27  9:12 [PATCH] fix leak of swap accounting as stale swap cache under memcg KAMEZAWA Hiroyuki
2009-04-27  9:12 ` KAMEZAWA Hiroyuki
2009-04-27 10:13 ` Balbir Singh
2009-04-27 10:13   ` Balbir Singh
2009-04-27 11:35   ` Daisuke Nishimura
2009-04-27 11:35     ` Daisuke Nishimura
2009-04-27 19:17     ` Balbir Singh
2009-04-27 19:17       ` Balbir Singh
2009-04-27 23:57       ` KAMEZAWA Hiroyuki [this message]
2009-04-27 23:57         ` KAMEZAWA Hiroyuki
2009-04-28 21:46         ` Balbir Singh
2009-04-28 21:46           ` Balbir Singh
2009-04-30  0:03           ` KAMEZAWA Hiroyuki
2009-04-30  0:03             ` KAMEZAWA Hiroyuki
2009-04-28  0:41   ` KAMEZAWA Hiroyuki
2009-04-28  0:41     ` KAMEZAWA Hiroyuki
2009-04-27 12:08 ` Daisuke Nishimura
2009-04-27 12:08   ` Daisuke Nishimura
2009-04-28  0:19   ` KAMEZAWA Hiroyuki
2009-04-28  0:19     ` KAMEZAWA Hiroyuki
2009-04-28  1:09     ` nishimura
2009-04-28  1:09       ` nishimura
2009-04-28  1:19       ` KAMEZAWA Hiroyuki
2009-04-28  1:19         ` KAMEZAWA Hiroyuki
2009-04-28  2:38         ` nishimura
2009-04-28  2:38           ` nishimura
2009-04-28  3:49       ` Daisuke Nishimura
2009-04-28  3:49         ` Daisuke Nishimura

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=20090428085753.a91b6007.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=hugh@veritas.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.