From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@linux-foundation.org>
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: Tue, 3 Jun 2008 01:41:22 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0806030116080.17244@blonde.site> (raw)
In-Reply-To: <20080602170031.d5c03225.akpm@linux-foundation.org>
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.
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.
Hugh
next prev parent reply other threads:[~2008-06-03 0:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 16:39 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 [this message]
2008-06-03 1:19 ` Andrew Morton
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=Pine.LNX.4.64.0806030116080.17244@blonde.site \
--to=hugh@veritas.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=davej@redhat.com \
--cc=greg@kroah.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
all inboxes | Powered by JetHome®