mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix bogus hotplug cpu warning
Date: Mon, 27 Aug 2007 22:09:46 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708272157260.3851@blonde.wat.veritas.com> (raw)
In-Reply-To: <20070827135212.6a5a847e.akpm@linux-foundation.org>

On Mon, 27 Aug 2007, Andrew Morton wrote:
> On Mon, 27 Aug 2007 21:37:14 +0100 (BST)
> Hugh Dickins <hugh@veritas.com> wrote:
> 
> > > So I agree with the patch, but not with its description.
> > 
> > I don't see which part of the description you disagree with, but please
> > do improve it if you can.
> 
> I'd change the description to
> 
> 
> current_is_keventd() is a stupid load of crap.  It does
> 
> int current_is_keventd(void)
> {
> 	struct cpu_workqueue_struct *cwq;
> 	int cpu = smp_processor_id();	/* preempt-safe: keventd is per-cpu */
> 
> but that comment (and the code itself) only make sense when
> current_is_keventd() is called by keventd.  In which case thers is no point
> in the function even existing!

I disagree.  The comment (your very own, I think?) and the code made
sense to me.  It's saying this is rather unusual, but safe against
preemption, because keventd is per-cpu (it might perhaps be better
if it said each keventd is bound to a cpu).

The code works in such a way that if it is a keventd, then it'll
correctly arrive at the answer yes; and if it's not a keventd,
then even if it's preempted to a different cpu in the middle,
the test won't match any keventd and so it'll correctly arrive
at the answer no.

But I'm content with the half-liner already there.

> 
> We need to use raw_smp_processor_id() so that non-keventd (or, more
> specifically, non-pinned-to-one-cpu) callers won't generate "using
> smp_processor_id() in preemptible" warnings.

Yes, that's true, raw_smp_processor_id() is needed to avoid the
warning; but it was already preempt-safe with smp_processor_id(),
just in danger of giving an inappropriate warning.

Hugh

      reply	other threads:[~2007-08-27 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-27 15:06 Hugh Dickins
2007-08-27 18:18 ` Andrew Morton
2007-08-27 20:37   ` Hugh Dickins
2007-08-27 20:52     ` Andrew Morton
2007-08-27 21:09       ` Hugh Dickins [this message]

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.0708272157260.3851@blonde.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.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 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®