Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932507AbbFEJsh (ORCPT ); Fri, 5 Jun 2015 05:48:37 -0400 Received: from www.linutronix.de ([62.245.132.108]:34759 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932464AbbFEJsd (ORCPT ); Fri, 5 Jun 2015 05:48:33 -0400 Date: Fri, 5 Jun 2015 11:48:20 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra cc: umgwanakikbuti@gmail.com, mingo@elte.hu, ktkhai@parallels.com, rostedt@goodmis.org, juri.lelli@gmail.com, pang.xunlei@linaro.org, oleg@redhat.com, wanpeng.li@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/14] hrtimer: Allow hrtimer::function() to free the timer In-Reply-To: <20150605085205.723058588@infradead.org> Message-ID: References: <20150605084836.364306429@infradead.org> <20150605085205.723058588@infradead.org> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1277 Lines: 44 On Fri, 5 Jun 2015, Peter Zijlstra wrote: > /* > + * We require the migration_base for lock_hrtimer_base()/switch_hrtimer_base() > + * such that hrtimer_callback_running() can unconditionally dereference > + * timer->base->cpu_base > + */ > +static struct hrtimer_cpu_base migration_cpu_base = { > + .seq = SEQCNT_ZERO(migration_cpu_base), > +}; > + > +static struct hrtimer_clock_base migration_base = { > + .cpu_base = &migration_cpu_base, > +}; You can spare that extra migration clock base, because migration_cpu_base already has clock bases inside. static struct hrtimer_cpu_base migration_cpu_base = { .seq = SEQCNT_ZERO(migration_cpu_base), }; and do: migration_cpu_base.clock_base[CLOCK_MONOTONIC].cpu_base = &migration_cpu_base; in hrtimer_init. So migration base becomes: #define migration_base &migration_cpu_base.clock_base[CLOCK_MONOTONIC] That's also more efficient in terms of cache because is two adjacent cache lines instead of two distant ones. Other than that, this looks good. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/