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: Wed, 27 May 2015 14:52:36 +0530 From: Viresh Kumar <viresh.kumar@...aro.org> To: Thomas Gleixner <tglx@...utronix.de> Cc: LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Paul McKenney <paulmck@...ux.vnet.ibm.com>, Frederic Weisbecker <fweisbec@...il.com>, Eric Dumazet <edumazet@...gle.com>, John Stultz <john.stultz@...aro.org>, Joonwoo Park <joonwoop@...eaurora.org>, Wenbo Wang <wenbo.wang@...blaze.com>, Steven Rostedt <rostedt@...dmis.org>, Badhri Jagan Sridharan <Badhri@...gle.com> Subject: Re: [patch 4/7] timer: Replace timer base by a cpu index On 26-05-15, 22:50, Thomas Gleixner wrote: > static struct tvec_base *lock_timer_base(struct timer_list *timer, > unsigned long *flags) > __acquires(timer->base->lock) > { > - struct tvec_base *base; > - > for (;;) { > - struct tvec_base *prelock_base = timer->base; > - base = tbase_get_base(prelock_base); > - if (likely(base != NULL)) { > + u32 tf = timer->flags; > + struct tvec_base *base; > + > + if (!(tf & TIMER_MIGRATING)) { > + base = per_cpu_ptr(&tvec_bases, tf & TIMER_CPUMASK); > spin_lock_irqsave(&base->lock, *flags); > - if (likely(prelock_base == timer->base)) > + if (timer->flags == tf) > return base; > - /* The timer has migrated to another CPU */ Maybe we should retain this comment. Its helpful for people who aren't very familiar with timer core. > static void migrate_timer_list(struct tvec_base *new_base, struct hlist_head *head) > { > struct timer_list *timer; > + int cpu = new_base->cpu; > > while (!hlist_empty(head)) { > timer = hlist_entry(head->first, struct timer_list, entry); > /* We ignore the accounting on the dying cpu */ > detach_timer(timer, false); > - timer_set_base(timer, new_base); > + timer->flags = (timer->flags & ~TIMER_BASEMASK) | cpu; Because 'cpu' is used only once in this routine, maybe we can use 'new_base->cpu' here and the line will still be exactly 80 columns long. Not sure, but maybe we can create a inline helper for this operation as it is repeated at multiple places. Look good otherwise: Reviewed-by: Viresh Kumar <viresh.kumar@...aro.org> -- viresh -- 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