Re: [PATCH] hotplug: Optimize {get,put}_online_cpus()

From: Steven Rostedt
Date: Tue Sep 24 2013 - 12:43:50 EST


On Tue, 24 Sep 2013 18:03:59 +0200
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 09/24, Peter Zijlstra wrote:
> >
> > +static inline void get_online_cpus(void)
> > +{
> > + might_sleep();
> > +
> > + if (current->cpuhp_ref++) {
> > + barrier();
> > + return;
>
> I don't undestand this barrier()... we are going to return if we already
> hold the lock, do we really need it?

I'm confused too. Unless gcc moves this after the release, but the
release uses preempt_disable() which is its own barrier.

If anything, it requires a comment.

-- Steve

>
> The same for put_online_cpus().
>
> > +void __get_online_cpus(void)
> > {
> > - if (cpu_hotplug.active_writer == current)
> > + if (cpuhp_writer_task == current)
> > return;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/