From: Andy Lutomirski <luto@amacapital.net>
To: jimmie.davis@l-3com.com, umgwanakikbuti@gmail.com
Cc: oneukum@suse.de, artem_fetishev@epam.com, peterz@infradead.org,
kosaki.motohiro@jp.fujitsu.com, linux-kernel@vger.kernel.org
Subject: Re: Bug 71331 - mlock yields processor to lower priority process
Date: Wed, 26 Mar 2014 17:39:42 -0700 [thread overview]
Message-ID: <5333734E.2020600@mit.edu> (raw)
In-Reply-To: <FFF95760268D324AB6DD9426E83C8DF70B2E595F@ARLEXCHMBX01.lst.link.l-3com.com>
On 03/21/2014 07:50 AM, jimmie.davis@l-3com.com wrote:
>
> ________________________________________
> From: Mike Galbraith [umgwanakikbuti@gmail.com]
> Sent: Friday, March 21, 2014 9:41 AM
> To: Davis, Bud @ SSG - Link
> Cc: oneukum@suse.de; artem_fetishev@epam.com; peterz@infradead.org; kosaki.motohiro@jp.fujitsu.com; linux-kernel@vger.kernel.org
> Subject: RE: Bug 71331 - mlock yields processor to lower priority process
>
> On Fri, 2014-03-21 at 14:01 +0000, jimmie.davis@l-3com.com wrote:
>
>> If you call mlock () from a SCHED_FIFO task, you expect it to return
>> when done. You don't expect it to block, and your task to be
>> pre-empted.
>
> Say some of your pages are sitting in an nfs swapfile orbiting Neptune,
> how do they get home, and what should we do meanwhile?
>
> -Mike
>
> Two options.
>
> #1. Return with a status value of EAGAIN.
>
> or
>
> #2. Don't return until you can do it.
>
> If SCHED_FIFO is used, and mlock() is called, the intention of the user is very clear. Run this task until
> it is completed or it blocks (and until a bit ago, mlock() did not block).
>
> SCHED_FIFO users don't care about fairness. They want the system to do what it is told.
I use mlock in real-time processes, but I do it in a separate thread.
Seriously, though, what do you expect the kernel to do? When you call
mlock on a page that isn't present, the kernel will *read* that page.
mlock will, therefore, block until the IO finishes.
Some time around 3.9, the behavior changed a little bit: IIRC mlock used
to hold mmap_sem while sleeping. Or maybe just mmap with MCL_FUTURE did
that. In any case, the mlock code is less lock-happy than it was. Is
it possible that you have two threads, and the non-mlock-calling thread
got blocked behind mlock, so it looked better?
--Andy
next prev parent reply other threads:[~2014-03-27 0:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 20:02 Bug 71331 - mlock yields processor to lower priority process Artem Fetishev
2014-03-21 9:23 ` Mike Galbraith
2014-03-21 12:18 ` jimmie.davis
2014-03-21 13:14 ` Mike Galbraith
2014-03-21 14:34 ` jimmie.davis
2014-03-21 14:54 ` Motohiro Kosaki
2014-03-21 13:35 ` Oliver Neukum
2014-03-21 14:01 ` jimmie.davis
2014-03-21 14:41 ` Mike Galbraith
2014-03-21 14:50 ` jimmie.davis
2014-03-27 0:39 ` Andy Lutomirski [this message]
2014-03-27 4:20 ` jimmie.davis
2014-03-27 5:35 ` Mike Galbraith
2014-03-27 6:02 ` Robert Hancock
2014-03-27 11:37 ` jimmie.davis
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=5333734E.2020600@mit.edu \
--to=luto@amacapital.net \
--cc=artem_fetishev@epam.com \
--cc=jimmie.davis@l-3com.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oneukum@suse.de \
--cc=peterz@infradead.org \
--cc=umgwanakikbuti@gmail.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;
as well as URLs for NNTP newsgroup(s).