lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 24 Sep 2013 12:39:27 -0400 From: Steven Rostedt <rostedt@...dmis.org> To: Peter Zijlstra <peterz@...radead.org> Cc: Oleg Nesterov <oleg@...hat.com>, Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>, Srikar Dronamraju <srikar@...ux.vnet.ibm.com>, Ingo Molnar <mingo@...nel.org>, Andrea Arcangeli <aarcange@...hat.com>, Johannes Weiner <hannes@...xchg.org>, Linux-MM <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>, Paul McKenney <paulmck@...ux.vnet.ibm.com>, Thomas Gleixner <tglx@...utronix.de> Subject: Re: [PATCH] hotplug: Optimize {get,put}_online_cpus() On Tue, 24 Sep 2013 14:38:21 +0200 Peter Zijlstra <peterz@...radead.org> wrote: > +#define cpuhp_writer_wait(cond) \ > +do { \ > + for (;;) { \ > + set_current_state(TASK_UNINTERRUPTIBLE); \ > + if (cond) \ > + break; \ > + schedule(); \ > + } \ > + __set_current_state(TASK_RUNNING); \ > +} while (0) > + > +void __get_online_cpus(void) The above really needs a comment about how it is used. Otherwise, I can envision someone calling this as "oh I can use this when I'm in a preempt disable section", and the comment below for the preempt_enable_no_resched() will no longer be true. -- Steve > { > - if (cpu_hotplug.active_writer == current) > + if (cpuhp_writer_task == current) > return; > - mutex_lock(&cpu_hotplug.lock); > > - if (WARN_ON(!cpu_hotplug.refcount)) > - cpu_hotplug.refcount++; /* try to fix things up */ > + atomic_inc(&cpuhp_waitcount); > + > + /* > + * We either call schedule() in the wait, or we'll fall through > + * and reschedule on the preempt_enable() in get_online_cpus(). > + */ > + preempt_enable_no_resched(); > + wait_event(cpuhp_wq, !__cpuhp_writer); > + preempt_disable(); > + > + /* > + * It would be possible for cpu_hotplug_done() to complete before > + * the atomic_inc() above; in which case there is no writer waiting > + * and doing a wakeup would be BAD (tm). > + * > + * If however we still observe cpuhp_writer_task here we know > + * cpu_hotplug_done() is currently stuck waiting for cpuhp_waitcount. > + */ > + if (atomic_dec_and_test(&cpuhp_waitcount) && cpuhp_writer_task) > + cpuhp_writer_wake(); > +} > +EXPORT_SYMBOL_GPL(__get_online_cpus); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists