From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752045AbbE0JWp (ORCPT ); Wed, 27 May 2015 05:22:45 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:36172 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751483AbbE0JWl (ORCPT ); Wed, 27 May 2015 05:22:41 -0400 Date: Wed, 27 May 2015 14:52:36 +0530 From: Viresh Kumar To: Thomas Gleixner Cc: LKML , Ingo Molnar , Peter Zijlstra , Paul McKenney , Frederic Weisbecker , Eric Dumazet , John Stultz , Joonwoo Park , Wenbo Wang , Steven Rostedt , Badhri Jagan Sridharan Subject: Re: [patch 4/7] timer: Replace timer base by a cpu index Message-ID: <20150527092236.GC2256@linux> References: <20150526210723.245729529@linutronix.de> <20150526224511.950084301@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150526224511.950084301@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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