All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Greg KH <gregkh@suse.de>, Ian Campbell <ijc@hellion.org.uk>,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	stable-review@kernel.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Jeremy Fitzhardinge <jeremy@goop.org>
Subject: Re: [RFC] mlock/stack guard interaction fixup
Date: Mon, 23 Aug 2010 19:40:21 +0200	[thread overview]
Message-ID: <1282585221.2605.2088.camel@laptop> (raw)
In-Reply-To: <19570.44367.719276.128881@chiark.greenend.org.uk>

On Mon, 2010-08-23 at 18:18 +0100, Ian Jackson wrote:
> Peter Zijlstra writes ("Re: [RFC] mlock/stack guard interaction fixup"):
> > On Mon, 2010-08-23 at 16:42 +0100, ijackson@chiark.greenend.org.uk
> > wrote:
> > > mlocking the stack is entirely sensible and normal for a real-time
> > > program.  Most such programs use mlockall but there is no particular
> > > reason why a program that has some more specific requirements should
> > > use mlock to lock only a part of the stack.  (Perhaps it has only one
> > > real-time thread?) 
> > 
> > RT apps should pre-allocate and mlock their stack in advance (and
> > pre-fault too for the paranoid).
> 
> Are you allowed to mlock a stack page which has not yet been faulted
> in ?  What effect does it have ?  I wasn't able to find a convincing
> de jure answer to this question.

mlock() seems to call make_pages_present(), so its a moot point.

> But you seem, like me, to be disagreeing with Linus's assertion that
> calling mlock() on the stack is something no sane programs does ?

I think the case that Linus called daft is splitting the stack vma
through mlock/mprotect, which is indeed something rarely done.

> > mlockall is a very bad interface and should really not be used.
> 
> You are directly contradicting the advice in SuS, to which I just gave
> a reference.  You're free to do so of course but it might be worth
> explaining in a bit more detail why the advice in SuS is wrong.

Because a real RT program will have a significant !RT part, and calling
mlock on everything is a massive resource waste.

Furthermore, mlockall gives the false impression that everything is good
to go for RT, disregarding pretty much everything that makes a RT app.

There's lots more to RT than sched_setscheduler() and
mlockall(MCL_FUTURE).

If a library is RT suited, it will already mlock() all relevant memory
allocations (or provide an option to do so, or strictly work on
externally allocated memory, which the user will then have mlock()'ed).



  parent reply	other threads:[~2010-08-23 17:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 23:59 [RFC] mlock/stack guard interaction fixup Linus Torvalds
2010-08-21  0:20 ` Mike Snitzer
2010-08-21  0:54   ` Linus Torvalds
2010-08-21 11:56 ` Ian Campbell
2010-08-21 15:48   ` Linus Torvalds
2010-08-21 16:08     ` Sam Ravnborg
2010-08-23 16:34       ` Tony Luck
2010-08-22  6:57     ` Ian Campbell
2010-08-22  7:33       ` Ian Campbell
2010-08-22  9:55         ` Ian Campbell
2010-08-22 16:43           ` Linus Torvalds
2010-08-22 17:25           ` Greg KH
2010-08-22 18:21             ` Linus Torvalds
2010-08-22 19:04               ` Greg KH
2010-08-23  9:22               ` Peter Zijlstra
2010-08-23 15:42               ` ijackson
2010-08-23 16:25                 ` Peter Zijlstra
2010-08-23 17:18                   ` Ian Jackson
2010-08-23 17:34                     ` Linus Torvalds
2010-08-23 17:53                       ` Peter Zijlstra
2010-08-23 17:59                       ` Peter Zijlstra
2010-08-23 18:43                         ` Darren Hart
2010-08-23 18:50                       ` Jeremy Fitzhardinge
2010-08-23 19:07                         ` Peter Zijlstra
2010-08-23 19:23                           ` Jeremy Fitzhardinge
2010-08-23 19:26                             ` Peter Zijlstra
2010-08-23 19:54                               ` Jeremy Fitzhardinge
2010-08-24  7:08                                 ` Peter Zijlstra
2010-08-24  7:20                                   ` Peter Zijlstra
2010-08-23 19:03                       ` Ian Campbell
2010-08-23 17:40                     ` Peter Zijlstra [this message]
2010-08-23 18:53                     ` Jeremy Fitzhardinge
2010-08-25  8:28             ` [Stable-review] " Stefan Bader
2010-08-23  9:00 ` Peter Zijlstra

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=1282585221.2605.2088.camel@laptop \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=ijackson@chiark.greenend.org.uk \
    --cc=ijc@hellion.org.uk \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --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 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.