public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Q: behaviour of mlockall(MCL_FUTURE) and VM_GROWSDOWN segments
Date: Fri, 11 Jan 2002 12:49:10 -0800	[thread overview]
Message-ID: <3C3F4FC6.97A6A66D@zip.com.au> (raw)
In-Reply-To: <3C3F3C7F.76CCAF76@colorfullife.com>

Manfred Spraul wrote:
> 
> If an app has an VM_GROWS{DOWN,UP} stack and calls
> mlockall(MCL_FUTURE|MCL_CURRENT), which pages should the kernel lock?
> 
> * grow the vma to the maximum size and lock all.
> * just according to the current size.
> 
> What should happen if the segment is extended by more than one page
> at once? (i.e. a function with 100 kB local variables)
> 
> * Just allocate the page that is needed to handle the page faults
> * always fill holes immediately.
> 
> Right now segments are not grown during the mlockall syscall. Some
> codepaths fill holes (find_extend_vma()), most don't (page fault
> handlers)
> 
> What's the right thing (tm) to do?
> I don't care which implementation is choosen, but IMHO all
> implementations should be identical

This was a problem encountered when taking a libpthread-based
application from 2.4.7 to 2.4.15.   It ran fine with mlockall
under 2.4.7, but under 2.4.15 everything wedged up.   This was, I assume,
because under 2.4.15, the many pthread stacks were fully faulted in and
locked at mlockall() time.    We ended up just not using mlockall
at all.

Really the 2.4.15 behaviour is correct, but undesirable.  It requires
each thread to know apriori what its maximum stack use will be.
(I'm assuming that there's a way of setting a thread's stack size
in libpthread).

So in this case, the behaviour I would prefer is MCL_FUTURE for
all vma's *except* the stack.   Stack pages should be locked
only when they are faulted in.   Hard call.

-

  reply	other threads:[~2002-01-11 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-11 19:26 Q: behaviour of mlockall(MCL_FUTURE) and VM_GROWSDOWN segments Manfred Spraul
2002-01-11 20:49 ` Andrew Morton [this message]
2002-01-11 23:45   ` Richard Gooch
     [not found] <3C3F3C7F.76CCAF76@colorfullife.com.suse.lists.linux.kernel>
     [not found] ` <3C3F4FC6.97A6A66D@zip.com.au.suse.lists.linux.kernel>
2002-01-12  0:33   ` Andi Kleen
2002-01-12  1:04     ` Andrew Morton
2002-01-12 15:33     ` Andrea Arcangeli
2002-01-12 15:54       ` Andi Kleen
2002-01-12 16:07         ` Manfred Spraul
2002-01-12 16:17           ` Andrea Arcangeli
2002-01-12 16:14         ` Andrea Arcangeli

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=3C3F4FC6.97A6A66D@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    /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