The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: vatsa@in.ibm.com, mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: more efficient current_is_keventd macro? [was Re: [lhcs-devel] Re: Kthread_create() never returns when called from worker_thread]
Date: Tue, 09 Mar 2004 12:50:39 +1100	[thread overview]
Message-ID: <1078797038.18171.707.camel@bach> (raw)
In-Reply-To: <20040308143658.25c1d378.akpm@osdl.org>

On Tue, 2004-03-09 at 09:36, Andrew Morton wrote:
> Srivatsa Vaddagiri <vatsa@in.ibm.com> wrote:
> > int current_is_keventd(void)
> > {
> > +       int cpu = smp_processor_id();
> > +	cwq = keventd_wq->cpu_wq + cpu;
> > +	if (current == cwq->thread)
> > +		return 1;
> > +	else
> > +		return 0;
> > }
> 
> Is racy in the presence of preemption.

Actually, it's not, because if current *is* keventd we're nailed to the
CPU, and if it's not, we're going to return false either way.

But it *should* be fixed, simply as an example to others.

Cheers,
Rusty.
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


  reply	other threads:[~2004-03-09  1:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08 12:30 more efficient current_is_keventd macro? [was Re: [lhcs-devel] Re: Kthread_create() never returns when called from worker_thread] Srivatsa Vaddagiri
2004-03-08 22:36 ` Andrew Morton
2004-03-09  1:50   ` Rusty Russell [this message]
2004-03-09 13:40   ` Srivatsa Vaddagiri

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=1078797038.18171.707.camel@bach \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=vatsa@in.ibm.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