From: Rusty Russell <rusty@rustcorp.com.au>
To: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Tejun Heo <tj@kernel.org>
Subject: Re: [RFC patch 5/5] infiniband: ehca: Use hotplug thread infrastructure
Date: Mon, 18 Jun 2012 16:00:16 +0930 [thread overview]
Message-ID: <87y5nlyvwn.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20120613105815.416416492@linutronix.de>
On Wed, 13 Jun 2012 11:00:56 -0000, Thomas Gleixner <tglx@linutronix.de> wrote:
> @@ -662,10 +663,15 @@ static inline int find_next_online_cpu(s
> ehca_dmp(cpu_online_mask, cpumask_size(), "");
>
> spin_lock_irqsave(&pool->last_cpu_lock, flags);
> - cpu = cpumask_next(pool->last_cpu, cpu_online_mask);
> - if (cpu >= nr_cpu_ids)
> - cpu = cpumask_first(cpu_online_mask);
> - pool->last_cpu = cpu;
> + while (1) {
> + cpu = cpumask_next(pool->last_cpu, cpu_online_mask);
> + if (cpu >= nr_cpu_ids)
> + cpu = cpumask_first(cpu_online_mask);
> + pool->last_cpu = cpu;
> + /* Might be on the way out */
> + if (per_cpu_ptr(pool->cpu_comp_tasks, cpu)->active)
> + break;
> + }
Heh, isn't this what we used to call a "do while" loop? :)
Your infrastructure is a really weird mix. On the one hand, it's a set
of callbacks: setup, cleanup, park, unpark. Cool.
On the other hand, instead of a 'run' callback, you've got a thread_fn,
which has to loop and call smpboot_thread_check_parking().
If you just had the thread_fn, it'd be trivial to follow program flow.
If you just had the callbacks, it'd still be pretty easy, though it
seems like a little too much help.
As it is, we have Paul doing setup stuff inside his thread_fn:
+ trace_rcu_utilization("Start CPU kthread@unpark");
+ sp.sched_priority = RCU_KTHREAD_PRIO;
+ sched_setscheduler_nocheck(current, SCHED_FIFO, &sp);
I'm just not sure this complexity wins us anything. Why not
just let people "register_percpu_kthread" and make the thread_fn
identical to normal kthread fns:
while (!kthread_should_stop()) {
if (kthread_should_park()) {
kthread_parkme();
continue;
}
Maybe implement a 'bool kthread_stop_or_park()' helper.
I'll whip up a patch on top of yours if you don't think it's crazy...
Cheers,
Rusty.
next prev parent reply other threads:[~2012-06-18 6:58 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 11:00 [RFC patch 0/5] Per cpu thread hotplug infrastructure Thomas Gleixner
2012-06-13 11:00 ` [RFC patch 1/5] kthread: Implement park/unpark facility Thomas Gleixner
2012-06-14 2:32 ` Namhyung Kim
2012-06-14 8:35 ` Thomas Gleixner
2012-06-14 8:59 ` Thomas Gleixner
2012-06-14 8:36 ` Srivatsa S. Bhat
2012-06-14 20:01 ` Silas Boyd-Wickizer
2012-06-14 20:13 ` Thomas Gleixner
2012-06-14 22:13 ` Silas Boyd-Wickizer
2012-06-15 1:44 ` Tejun Heo
2012-06-13 11:00 ` [RFC patch 2/5] smpboot: Provide infrastructure for percpu hotplug threads Thomas Gleixner
2012-06-13 18:33 ` Paul E. McKenney
2012-06-13 18:56 ` Thomas Gleixner
2012-06-14 8:08 ` Peter Zijlstra
2012-06-14 8:17 ` Peter Zijlstra
2012-06-15 1:53 ` Tejun Heo
2012-06-15 9:58 ` Peter Zijlstra
2012-06-14 8:37 ` Thomas Gleixner
2012-06-14 8:38 ` Peter Zijlstra
2012-06-13 18:57 ` Paul E. McKenney
2012-06-13 19:02 ` Thomas Gleixner
2012-06-13 19:17 ` Paul E. McKenney
2012-06-13 20:47 ` Paul E. McKenney
2012-06-14 4:51 ` Paul E. McKenney
2012-06-14 11:20 ` Thomas Gleixner
2012-06-14 12:59 ` Paul E. McKenney
2012-06-14 13:01 ` Peter Zijlstra
2012-06-14 14:47 ` Paul E. McKenney
2012-06-14 14:56 ` Peter Zijlstra
2012-06-14 15:07 ` Thomas Gleixner
2012-06-14 15:45 ` Paul E. McKenney
2012-06-14 16:20 ` Thomas Gleixner
2012-06-14 13:32 ` Thomas Gleixner
2012-06-14 13:47 ` Thomas Gleixner
2012-06-14 14:12 ` Thomas Gleixner
2012-06-14 15:01 ` Paul E. McKenney
2012-06-14 15:08 ` Thomas Gleixner
2012-06-14 14:50 ` Paul E. McKenney
2012-06-14 15:02 ` Thomas Gleixner
2012-06-14 15:38 ` Paul E. McKenney
2012-06-14 16:19 ` Thomas Gleixner
2012-06-14 16:48 ` Paul E. McKenney
2012-06-14 22:40 ` Paul E. McKenney
2012-06-14 8:31 ` Srivatsa S. Bhat
2012-06-14 8:44 ` Thomas Gleixner
2012-06-18 8:47 ` Cyrill Gorcunov
2012-06-18 8:50 ` Thomas Gleixner
2012-06-13 11:00 ` [RFC patch 3/5] softirq: Use hotplug thread infrastructure Thomas Gleixner
2012-06-13 11:00 ` [RFC patch 4/5] watchdog: " Thomas Gleixner
2012-06-13 11:00 ` [RFC patch 5/5] infiniband: ehca: " Thomas Gleixner
2012-06-18 6:30 ` Rusty Russell [this message]
2012-06-18 8:08 ` Thomas Gleixner
2012-06-24 10:29 ` Thomas Gleixner
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=87y5nlyvwn.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--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 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.