linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Nick Piggin <npiggin@suse.de>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"hugh.dickins@tiscali.co.uk" <hugh.dickins@tiscali.co.uk>,
	avi@redhat.com,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	torvalds@linux-foundation.org
Subject: Re: [RFC][PATCH 0/4] ZERO PAGE again v2
Date: Thu, 9 Jul 2009 10:12:19 +0900	[thread overview]
Message-ID: <20090709101219.17d8f8a3.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20090708173206.GN356@random.random>

On Wed, 8 Jul 2009 19:32:06 +0200
Andrea Arcangeli <aarcange@redhat.com> wrote:

> On Tue, Jul 07, 2009 at 06:06:29PM +0900, KAMEZAWA Hiroyuki wrote:
> > Then,  most of users will not notice that ZERO_PAGE is not available until
> > he(she) find OOM-Killer message. This is very terrible situation for me.
> > (and most of system admins.)
> 
> Can you try to teach them to use KSM and see if they gain a while lot
> more from it (surely they also do some memset(dst, 0) sometime not
> only memcpy(zerosrc, dst)). Not to tell when they init to non zero
> values their arrays/matrix which is a bit harder to optimize for with
> zero page...
> 
Hmm, scan & take diff & merge user pages in the kernel ?
IIUC, it can be only help if zero-page's life time are verrrry long.

> My only dislike is that zero page requires a flood of "if ()" new
> branches in fast paths that benefits nothing but badly written app,
> and that's the only reason I liked its removal.
> 
I'll take Linus's suggestion "use pte_special() in vm_normal_page()".
Then, "if()" will not increase so much as expected, flood.

In usual apps which doen't use any zero-page, following path will be checked.

 - "is this WRITE fault ?" in do_anonymous_page().
 - vm_normal_page() never finds pte_special() then no more "if"s.
 - get_user_pages() etc..will have more 2-3 if()s depends on passed flags.

Anyway, I'll reduce overheads as much as possible. please see v3.
pte_special() checks (which are already used) reduce "if()" to some extent.

> For goodly (and badly) written scientific app there KSM that will do
> more than zeropage while dealing with matrix algorithms and such. If
> they try KSM and they don't gain a lot more free memory than with the
> zero page hack, then I agree in reintroducing it, but I guess when
> they try KSM they will ask you to patch kernel with it, instead of
> patch kernel with zeropage. 

Most of the difference between zeropage and KSM solution is that
zeropage requires no refcnt/rmap handling, never pollutes caches, etc.
This will be big advantage.

> If they don't gain anything more with KSM
> than with zeropage, and the kksmd overhead is too high, then it would
> make sense to use zeropage for them I agree even if it bites in the
> fast path of all apps that can't benefit from it. (not to tell the
> fact that reading zero and writing non zero back for normal apps is
> harmful as there's a double page fault generated instead of a single
> one, kksmd has a cost but zeropage isn't free either in term of page
> faults too)
> 
Sorry, my _all_ customers use RHEL5 and there are no ksm yet.

BTW, I love concepts of KSM but I don't trust KSM so much as that I recommend
it to my customers, yet. It's a bit young for production in my point of view.
AFAIK, no bug reports of ksm has reached this mailing list, yet.

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-07-09  1:01 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07  7:51 KAMEZAWA Hiroyuki
2009-07-07  7:52 ` [RFC][PATCH 1/4] introduce pte_zero() KAMEZAWA Hiroyuki
2009-07-07  7:54 ` [RFC][PATCH 2/4] use ZERO_PAGE for READ fault in regular anonymous mapping KAMEZAWA Hiroyuki
2009-07-07  7:59 ` [RFC][PATCH 3/4] get_user_pages READ fault handling special cases KAMEZAWA Hiroyuki
2009-07-07 16:50   ` Linus Torvalds
2009-07-08  0:03     ` KAMEZAWA Hiroyuki
2009-07-08  1:38       ` KAMEZAWA Hiroyuki
2009-07-08  2:27         ` Linus Torvalds
2009-07-07  8:01 ` [RFC][PATCH 4/4] add get user pages nozero KAMEZAWA Hiroyuki
2009-07-07  8:47 ` [RFC][PATCH 0/4] ZERO PAGE again v2 Nick Piggin
2009-07-07  9:05   ` Avi Kivity
2009-07-07  9:18     ` KAMEZAWA Hiroyuki
2009-07-07  9:26       ` Avi Kivity
2009-07-07  9:06   ` KAMEZAWA Hiroyuki
2009-07-07 14:00     ` Nick Piggin
2009-07-07 16:59       ` Linus Torvalds
2009-07-08  6:21         ` Nick Piggin
2009-07-08 16:07           ` Linus Torvalds
2009-07-09  7:47             ` Nick Piggin
2009-07-09 17:54               ` Linus Torvalds
2009-07-10  2:09                 ` Nick Piggin
2009-07-10  3:38                   ` Linus Torvalds
2009-07-10  3:51                     ` Nick Piggin
2009-07-08 17:32     ` Andrea Arcangeli
2009-07-09  1:12       ` KAMEZAWA Hiroyuki [this message]
2009-07-10 11:18       ` Hugh Dickins
2009-07-10 13:42         ` Andrea Arcangeli
2009-07-10 14:12           ` KAMEZAWA Hiroyuki
2009-07-10 15:16             ` Andrea Arcangeli
2009-07-10 15:32               ` KAMEZAWA Hiroyuki
2009-07-10 17:09           ` Hugh Dickins
2009-07-13  6:46         ` Nick Piggin
2009-07-13  7:24           ` Nick Piggin
2009-07-07 15:50 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=20090709101219.17d8f8a3.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=torvalds@linux-foundation.org \
    /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