From: Peter Zijlstra <peterz@infradead.org>
To: mingo@kernel.org, oleg@redhat.com, gkohli@codeaurora.org
Cc: tglx@linutronix.de, mpe@ellerman.id.au, bigeasy@linutronix.de,
linux-kernel@vger.kernel.org, will.deacon@arm.com,
"Peter Zijlstra (Intel)" <peterz@infradead.org>
Subject: [PATCH 4/4] kthread: Simplify kthread_park() completion
Date: Thu, 07 Jun 2018 14:33:14 +0200 [thread overview]
Message-ID: <20180607124006.266038375@infradead.org> (raw)
In-Reply-To: 20180607123310.866085998@infradead.org
[-- Attachment #1: peterz-kthread-3.patch --]
[-- Type: text/plain, Size: 1337 bytes --]
Now that smpboot_update_cpumask_percpu_thread() is gone, we no longer
have anybody calling kthread_park() on already parked threads. So
revert commit:
b1f5b378e126 ("kthread: Allow kthread_park() on a parked kthread")
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/kthread.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -190,7 +190,7 @@ static void __kthread_parkme(struct kthr
if (!test_bit(KTHREAD_SHOULD_PARK, &self->flags))
break;
- complete_all(&self->parked);
+ complete(&self->parked);
schedule();
}
__set_current_state(TASK_RUNNING);
@@ -465,7 +465,6 @@ void kthread_unpark(struct task_struct *
if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags))
__kthread_bind(k, kthread->cpu, TASK_PARKED);
- reinit_completion(&kthread->parked);
clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
/*
* __kthread_parkme() will either see !SHOULD_PARK or get the wakeup.
@@ -493,6 +492,9 @@ int kthread_park(struct task_struct *k)
if (WARN_ON(k->flags & PF_EXITING))
return -ENOSYS;
+ if (WARN_ON_ONCE(test_bit(KTHREAD_SHOULD_PARK, &kthread->flags)))
+ return -EBUSY;
+
set_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
if (k != current) {
wake_up_process(k);
next prev parent reply other threads:[~2018-06-07 12:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 12:33 [PATCH 0/4] kthread/smpboot: More fixes Peter Zijlstra
2018-06-07 12:33 ` [PATCH 1/4] kthread, sched: Fix kthread_parkme() (again...) Peter Zijlstra
2018-06-07 12:33 ` [PATCH 2/4] watchdog/softlockup: Replace "watchdog/%u" threads with cpu_stop_work Peter Zijlstra
2018-06-07 14:24 ` Peter Zijlstra
2018-06-07 14:42 ` Peter Zijlstra
2018-06-08 13:57 ` Oleg Nesterov
2018-06-12 12:17 ` Peter Zijlstra
2018-06-07 12:33 ` [PATCH 3/4] smpboot: Remove cpumask from the API Peter Zijlstra
2018-06-07 12:33 ` Peter Zijlstra [this message]
2018-06-08 9:52 ` [PATCH 4/4] kthread: Simplify kthread_park() completion Oleg Nesterov
2018-06-12 12:42 ` Peter Zijlstra
2018-06-25 7:12 ` Peter Zijlstra
2018-06-25 16:53 ` Oleg Nesterov
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=20180607124006.266038375@infradead.org \
--to=peterz@infradead.org \
--cc=bigeasy@linutronix.de \
--cc=gkohli@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).