All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Kirill Tkhai <ktkhai@parallels.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] smpboot: Use preempt_enable_no_resched() before schedule()
Date: Wed, 12 Feb 2014 12:38:55 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1402121226150.21991@ionos.tec.linutronix.de> (raw)
In-Reply-To: <20140212101954.17530.53675.stgit@tkhai>

On Wed, 12 Feb 2014, Kirill Tkhai wrote:

No, preempt_enable_no_resched() should just die. If you want to get
rid of the preempt_enable() / schedule() sequence just use
schedule_preempt_disabled(). See below.

Thanks,

	tglx


--- linux-2.6.orig/kernel/smpboot.c
+++ linux-2.6/kernel/smpboot.c
@@ -106,9 +106,9 @@ static int smpboot_thread_fn(void *data)
 	struct smpboot_thread_data *td = data;
 	struct smp_hotplug_thread *ht = td->ht;
 
+	preempt_disable();
 	while (1) {
 		set_current_state(TASK_INTERRUPTIBLE);
-		preempt_disable();
 		if (kthread_should_stop()) {
 			set_current_state(TASK_RUNNING);
 			preempt_enable();
@@ -128,6 +128,7 @@ static int smpboot_thread_fn(void *data)
 			}
 			kthread_parkme();
 			/* We might have been woken for stop */
+			preempt_disable();
 			continue;
 		}
 
@@ -152,12 +153,12 @@ static int smpboot_thread_fn(void *data)
 		}
 
 		if (!ht->thread_should_run(td->cpu)) {
-			preempt_enable();
-			schedule();
+			schedule_preempt_disabled();
 		} else {
 			set_current_state(TASK_RUNNING);
 			preempt_enable();
 			ht->thread_fn(td->cpu);
+			preempt_disable();
 		}
 	}
 }

      reply	other threads:[~2014-02-12 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 10:19 [PATCH] smpboot: Use preempt_enable_no_resched() before schedule() Kirill Tkhai
2014-02-12 11:38 ` Thomas Gleixner [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=alpine.DEB.2.02.1402121226150.21991@ionos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=ktkhai@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.