public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: mjy@geizhals.at, linux-kernel@vger.kernel.org
Subject: Re: CONFIG_PREEMPT and server workloads
Date: Thu, 18 Mar 2004 20:01:26 +0100	[thread overview]
Message-ID: <20040318190126.GA2022@dualathlon.random> (raw)
In-Reply-To: <20040318104729.0de30117.akpm@osdl.org>

On Thu, Mar 18, 2004 at 10:47:29AM -0800, Andrew Morton wrote:
> Andrea Arcangeli <andrea@suse.de> wrote:
> >
> > > hand so we should only fall into the kmap() if the page was suddenly stolen
> >  > again.
> > 
> >  Oh so you mean the page fault insn't only interrupting the copy-user
> >  atomically, but the page fault is also going to sleep and pagein the
> >  page? I though you didn't want to allow other tasks to steal the kmap
> >  before you effectively run the kunmap_atomic. I see it can be safe if
> >  kunmap_atomic is a noop though, but you're effectively allowing
> >  scheduling inside a kmap this way.
> 
> No, we don't schedule with the atomic kmap held.  What I meant was:

good to hear this (even scheduling inside an atomic kmap could be made
to work but I would find it less obviously safe since kumap_atomic would
need to be a noop for example).

> 
> 	get_user(page);		/* fault it in */
> 	kmap_atomic(page);
> 	if (copy_from_user(page))
> 		goto slow_path;
> 	kunmap_atomic(page);
> 
> 	...
> 
> slow_path:
> 	kunmap_atomic(page);
> 	kmap(page);
> 	copy_from_user(page);
> 	kunmap(page);
> 

I see what you mean now, so you suggest to run an unconditional
get_user(). It's hard to tell here, I agree the cost would be nearly
zero since the loaded byte from memory it'll go into l1 cache and it
would avoid a page fault in some unlikely case compared to what I
proposed, but I don't like too much it because I really like to optimize
as much as possible for the fast path always, so I still like to keep
the get_user out of the fast path. But you're right to argue since it's
hard to tell what's better in practice (certainly one could write a
malicious load where the additional pagefault could be measurable, while
the get_user would always be hardly measurable).

  reply	other threads:[~2004-03-18 19:00 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18  4:00 CONFIG_PREEMPT and server workloads Marinos J. Yannikos
2004-03-18  5:12 ` Andrew Morton
2004-03-18  6:03 ` Andrea Arcangeli
2004-03-18  9:50   ` Andrew Morton
2004-03-18 14:51     ` Andrea Arcangeli
2004-03-18 15:34       ` Robert Love
2004-03-18 16:01         ` Andrea Arcangeli
2004-03-18 17:39       ` Andrew Morton
2004-03-18 17:58         ` Andrea Arcangeli
2004-03-18 18:26           ` Andrew Morton
2004-03-18 18:38             ` Andrea Arcangeli
2004-03-18 18:47               ` Andrew Morton
2004-03-18 19:01                 ` Andrea Arcangeli [this message]
2004-03-18 17:48       ` Robert Love
2004-03-18 18:00         ` Andrea Arcangeli
2004-03-20 10:48         ` Jamie Lokier
2004-03-19  2:17       ` Nick Piggin
     [not found]         ` <20040319050948.GN2045@holomorphy.com>
2004-03-20 12:14           ` Andrea Arcangeli
2004-03-20 14:51             ` William Lee Irwin III
2004-03-20 15:03               ` Andrea Arcangeli
2004-03-20 15:09                 ` William Lee Irwin III
2004-03-24 13:57                 ` Takashi Iwai
2004-03-24 14:52                   ` Andrea Arcangeli
2004-03-24 15:11                   ` William Lee Irwin III
2004-03-18 15:20     ` Tom Sightler
2004-03-18 15:37       ` Andrea Arcangeli
2004-03-18 23:54         ` Tom Sightler
2004-03-18 15:39       ` Robert Love
2004-03-18 15:28   ` Takashi Iwai
2004-03-18 15:40     ` Robert Love
2004-03-18 15:42     ` Andrea Arcangeli
2004-03-18 19:01     ` Andrew Morton
2004-03-18 19:08       ` Takashi Iwai
2004-03-18 19:18         ` Andrew Morton
2004-03-18 19:20           ` Takashi Iwai
2004-03-18 19:43             ` Andrea Arcangeli
2004-03-18 19:50               ` Takashi Iwai
2004-03-18 19:24         ` Robert Love
2004-03-19 22:03           ` Valdis.Kletnieks
2004-03-19 22:12             ` Robert Love
2004-03-24 15:00               ` Takashi Iwai
2004-03-18 19:16       ` Takashi Iwai
2004-03-18 19:29         ` Andrew Morton
2004-03-18 19:48           ` Chris Mason
2004-03-19 11:37             ` Takashi Iwai
2004-03-19 13:46               ` Chris Mason
2004-03-19 14:06                 ` Takashi Iwai
     [not found]         ` <20040318221006.74246648.akpm@osdl.org>
2004-03-19 10:30           ` Takashi Iwai
2004-03-23  9:14             ` Dipankar Sarma
2004-03-19 17:22           ` Dipankar Sarma
2004-03-19 18:03             ` Andrew Morton
2004-03-20 12:24             ` Andrea Arcangeli
2004-03-20 13:13               ` Dipankar Sarma
2004-03-18 19:39       ` Andrea Arcangeli
2004-03-18 22:32     ` Andrew Morton
2004-03-18 22:54       ` Chris Mason
2004-03-18 23:57         ` Andrew Morton
2004-03-19 20:46           ` Takashi Iwai
2004-03-19 21:08             ` Andrew Morton
2004-03-19  3:07     ` Eric St-Laurent
2004-03-19 11:23       ` Takashi Iwai
2004-03-19 13:35         ` Chris Mason

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=20040318190126.GA2022@dualathlon.random \
    --to=andrea@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjy@geizhals.at \
    /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