From: Namhyung Kim <namhyung@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
Rusty Russell <rusty@rustcorp.com.au>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Tejun Heo <tj@kernel.org>
Subject: Re: [RFC patch V2 2/7] kthread: Implement park/unpark facility
Date: Mon, 18 Jun 2012 17:43:41 +0900 [thread overview]
Message-ID: <87hau9huwy.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20120615140714.456322600@linutronix.de> (Thomas Gleixner's message of "Fri, 15 Jun 2012 14:13:21 -0000")
On Fri, 15 Jun 2012 14:13:21 -0000, Thomas Gleixner wrote:
> To avoid the full teardown/setup of per cpu kthreads in the case of
> cpu hot(un)plug, provide a facility which allows to put the kthread
> into a park position and unpark it when the cpu comes online again.
>
Please see a comment below. Other than that, you can add my
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
if you want.
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> include/linux/kthread.h | 11 ++
> kernel/kthread.c | 184 +++++++++++++++++++++++++++++++++++++++++++-----
> 2 files changed, 175 insertions(+), 20 deletions(-)
[snip]
> /**
> + * kthread_create_on_cpu - Create a cpu bound kthread
> + * @threadfn: the function to run until signal_pending(current).
> + * @data: data ptr for @threadfn.
> + * @cpu: The cpu on which the thread should be bound,
> + * @namefmt: printf-style name for the thread.
How about adding a comment that @namefmt can handle a single %u only
for the cpu number in the current implementation?
Thanks,
Namhyung
> + *
> + * Description: This helper function creates and names a kernel thread
> + * The thread will be woken and put into park mode.
> + */
> +struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data),
> + void *data, unsigned int cpu,
> + const char *namefmt)
> +{
> + struct task_struct *p;
> +
> + p = kthread_create_on_node(threadfn, data, cpu_to_node(cpu), namefmt,
> + cpu);
> + if (IS_ERR(p))
> + return p;
> + set_bit(KTHREAD_IS_PER_CPU, &to_kthread(p)->flags);
> + to_kthread(p)->cpu = cpu;
> + /* Park the thread to get it out of TASK_UNINTERRUPTIBLE state */
> + kthread_park(p);
> + return p;
> +}
> +
next prev parent reply other threads:[~2012-06-18 8:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 14:13 [RFC patch V2 0/7] Per cpu thread hotplug infrastructure Thomas Gleixner
2012-06-15 14:13 ` [RFC patch V2 1/7] rcu: Yield simpler Thomas Gleixner
2012-06-15 14:13 ` [RFC patch V2 3/7] smpboot: Provide infrastructure for percpu hotplug threads Thomas Gleixner
2012-06-15 14:13 ` [RFC patch V2 2/7] kthread: Implement park/unpark facility Thomas Gleixner
2012-06-18 8:43 ` Namhyung Kim [this message]
2012-06-18 8:50 ` Thomas Gleixner
2012-06-15 14:13 ` [RFC patch V2 4/7] softirq: Use hotplug thread infrastructure Thomas Gleixner
2012-06-15 21:49 ` Paul E. McKenney
2012-06-15 14:13 ` [RFC patch V2 5/7] watchdog: " Thomas Gleixner
2012-06-15 14:13 ` [RFC patch V2 6/7] rcu: Use smp_hotplug_thread facility for RCUs per-CPU kthread Thomas Gleixner
2012-06-15 14:13 ` [RFC patch V2 7/7] infiniband: ehca: Use hotplug thread infrastructure Thomas Gleixner
2012-06-26 23:26 ` [RFC patch V2 0/7] Per cpu thread hotplug infrastructure Paul E. McKenney
2012-06-27 9:52 ` Peter Zijlstra
2012-06-27 14:14 ` Paul E. McKenney
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=87hau9huwy.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rusty@rustcorp.com.au \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.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®