linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Zoltan.Menyhart@bull.net
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Anton Blanchard <anton@samba.org>,
	Paul Mackerras <paulus@samba.org>,
	linuxppc64-dev@lists.linuxppc.org
Subject: Re: RFC: COW for hugepages
Date: Fri, 9 Apr 2004 00:19:25 +1000	[thread overview]
Message-ID: <20040408141925.GB16928@zax> (raw)
In-Reply-To: <4075333B.4C90934C@nospam.org>

On Thu, Apr 08, 2004 at 01:10:51PM +0200, Zoltan Menyhart wrote:
> David Gibson wrote:
> 
> > > Why not just add a flag for a VMA telling if you want / do not want to
> > > copy it on "fork()" ? E.g.:
> > >
> > > dup_mmap():
> > >
> > >       for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) {
> > >
> > >               if (mpnt->vm_flags & VM_HUGETLB_DONT_COPY)
> > >                       <do nothing>
> > >       }
> > >
> > 
> > Um.. why would that be useful?
> 
> I think there are 2 major cases:
> 
> - A big hugepage-using program creates threads to take advantage
>   of all of the CPUs => use clone2(...CLONEVM...), it works today.
> - Another big hugepage-using program calling a little shell function
>   with system() => just skip the VMA of the huge page area in
> 	do_fork():
> 		copy_process():
> 			copy_mm():
> 				dup_mmap()
>   The child will have no copy of the huge page area. No problem, it will
>   exec() soon, and the stack, the usual data, the malloc()'ed data, etc.
>   are not in the huge page area => exec() will will work correctly.

> I do not think we need a COW of the huge pages.

Both of these two cases work already.  The fork() will copy the huge
PTEs, but that's no big deal since all the actual pages are shared.
COW isn't supposed to help either case - it's for cases where we
really do need MAP_PRIVAT semantics.  That's particularly important
for things we might do in the future where large pages are allocated
automatically according to certain heuristics.  In this case we
certainly can't make the pages silently have different semantics to
normal anonymous memory.

-- 
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

  reply	other threads:[~2004-04-08 14:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-07  7:42 RFC: COW for hugepages David Gibson
2004-04-07  7:53 ` Andrew Morton
2004-04-07  8:03   ` Anton Blanchard
2004-04-07  8:29   ` Benjamin Herrenschmidt
2004-04-08  1:57     ` David Gibson
2004-04-07  9:00 ` Zoltan Menyhart
2004-04-08  1:53   ` David Gibson
2004-04-08 11:10     ` Zoltan Menyhart
2004-04-08 14:19       ` David Gibson [this message]
2004-04-07 12:34 ` Andi Kleen
2004-04-07 14:27   ` Anton Blanchard
2004-04-07 14:50     ` Andi Kleen
2004-04-07 21:41       ` Anton Blanchard
2004-04-07 21:47         ` Andi Kleen
2004-04-08  1:11   ` Benjamin Herrenschmidt
2004-04-08  2:01     ` Andrew Morton
2004-04-08  3:09       ` David Gibson
2004-04-08  3:24         ` Andrew Morton
2004-04-08  3:56           ` David Gibson
2004-04-08  1:50   ` David Gibson
2004-04-07 15:21 ` Dave Hansen
2004-04-08  3:22   ` David Gibson

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=20040408141925.GB16928@zax \
    --to=david@gibson.dropbear.id.au \
    --cc=Zoltan.Menyhart@bull.net \
    --cc=akpm@osdl.org \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@lists.linuxppc.org \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).