public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Subbaraman Narayanamurthy <subbaram@codeaurora.org>,
	daniel@numascale.com, yuyang.du@intel.com,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH]: kthread: Fix memory ordering in __kthread_parkme
Date: Fri, 7 Nov 2014 19:41:03 +0100	[thread overview]
Message-ID: <20141107184103.GA16043@redhat.com> (raw)
In-Reply-To: <20141107102855.GA29390@twins.programming.kicks-ass.net>

On 11/07, Peter Zijlstra wrote:
>
>  static void __kthread_parkme(struct kthread *self)
>  {
> -	__set_current_state(TASK_PARKED);
> +	set_current_state(TASK_PARKED);
>  	while (test_bit(KTHREAD_SHOULD_PARK, &self->flags)) {
>  		if (!test_and_set_bit(KTHREAD_IS_PARKED, &self->flags))
>  			complete(&self->parked);
>  		schedule();
> -		__set_current_state(TASK_PARKED);
> +		set_current_state(TASK_PARKED);
>  	}

Perhaps it makses sense to do set_current_state(PARKED) once at the start
of "for (;;)" loop, but this is cosmetic.

What if kthread_unpark() is called right after test_bit(KTHREAD_SHOULD_PARK)
and KTHREAD_IS_PARKED is not set? It seems that __kthread_unpark() should
call wake_up_state() unconditionally ?

Oleg.


  reply	other threads:[~2014-11-07 18:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 15:01 hotplug thread issues Peter Zijlstra
2014-11-07  9:39 ` Thomas Gleixner
2014-11-07 10:28   ` [PATCH]: kthread: Fix memory ordering in __kthread_parkme Peter Zijlstra
2014-11-07 18:41     ` Oleg Nesterov [this message]
2014-11-07 21:27       ` Peter Zijlstra

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=20141107184103.GA16043@redhat.com \
    --to=oleg@redhat.com \
    --cc=daniel@numascale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=subbaram@codeaurora.org \
    --cc=tglx@linutronix.de \
    --cc=yuyang.du@intel.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