public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Hugh Dickins <hugh@veritas.com>
Cc: arjan@linux.intel.com, linux-kernel@vger.kernel.org,
	torvalds@linux-foundation.org, mingo@elte.hu, greg@kroah.com,
	jeff@garzik.org, davej@redhat.com
Subject: Re: Top kernel oopses/warnings for the week of May 30th 2008
Date: Mon, 2 Jun 2008 18:19:55 -0700	[thread overview]
Message-ID: <20080602181955.ae5c99b8.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0806030116080.17244@blonde.site>

On Tue, 3 Jun 2008 01:41:22 +0100 (BST) Hugh Dickins <hugh@veritas.com> wrote:

> On Mon, 2 Jun 2008, Andrew Morton wrote:
> > On Tue, 3 Jun 2008 00:44:38 +0100 (BST)
> > Hugh Dickins <hugh@veritas.com> wrote:
> > 
> > > +					if (in_atomic())
> > > +						kunmap_atomic(kaddr, KM_USER0);
> > > +					else
> > > +						kunmap(kmapped_page);
> > 
> > eek.
> > 
> > /*
> >  * Are we running in atomic context?  WARNING: this macro cannot
> >  * always detect atomic context; in particular, it cannot know about
> >  * held spinlocks in non-preemptible kernels.  Thus it should not be
> >  * used in the general case to determine whether sleeping is possible.
> >  * Do not use in_atomic() in driver code.
> >  */
> > #define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE)
> 
> Yes, that comment is all about how a common function cannot be expected
> to guess whether it's being called in atomic context or not; but we
> know that we don't have any spinlocks held here, therefore it's okay.
> 
> Or do you consider fs/exec.c a driver, and shouldn't set bad example?
> It is exactly the test that do_page_fault() makes at the other end,
> when deciding whether it can handle the fault.

Well, if you're sure..  I didn't look very closely (sorry), nor did you
explain very closely.

I think doing this sort of thing is OK in fs/exec.c from the
should-we-be-doing-this-in there POV, but it should have suitable comments
slapped all over it.

> Originally I had a bool atomic there instead.  I switched over to
> testing in_atomic() itself because I had it mind to suggest another
> patch: it has long seemed wrong to me that we should have to disable
> preemption and fault handling there, when often (on many architectures,
> or on many pages) it's unnecessary.
> 
> So I'd like to change (the various implementations of) kmap_atomic()
> to use pagefault_disable() only when the page actually is in highmem.

So...  places like file_read_actor() would be given an open-coded
pagefault_disable() so we preserve out implicit boolean-passing down to
do_page_fault()?

One of the reasons why we (I?) left kmap_atomic() doing
pagefault_disable() for all pages was testing coverage: not many
developers test with highmem nowadays so there's a high risk (almost a
certainty) that people will start adding can-schedule code inside their
kmap_atomic() regions.  Probably it's not a terribly good reason...

  reply	other threads:[~2008-06-03  1:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 16:39 Top kernel oopses/warnings for the week of May 30th 2008 Arjan van de Ven
2008-05-30 19:19 ` Hugh Dickins
2008-05-30 21:43   ` Linus Torvalds
2008-05-30 21:49     ` Arjan van de Ven
2008-05-30 22:17       ` Arjan van de Ven
2008-05-30 22:00     ` Arjan van de Ven
2008-05-30 22:30       ` Linus Torvalds
2008-05-30 22:34         ` Arjan van de Ven
2008-05-30 22:55           ` Linus Torvalds
2008-05-31  0:41             ` Dave Jones
2008-06-02 23:44   ` Hugh Dickins
2008-06-03  0:00     ` Andrew Morton
2008-06-03  0:41       ` Hugh Dickins
2008-06-03  1:19         ` Andrew Morton [this message]
2008-06-09 16:32     ` Ingo Molnar
2008-06-10 12:42       ` Hugh Dickins
2008-05-30 22:34 ` Jochen Voß
2008-05-30 22:36   ` Arjan van de Ven
2008-06-02  0:02 ` James Morris
2008-06-02  2:27   ` Arjan van de Ven

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=20080602181955.ae5c99b8.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=davej@redhat.com \
    --cc=greg@kroah.com \
    --cc=hugh@veritas.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox