From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753189AbbC1Lln (ORCPT ); Sat, 28 Mar 2015 07:41:43 -0400 Received: from casper.infradead.org ([85.118.1.10]:49636 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753144AbbC1Lll (ORCPT ); Sat, 28 Mar 2015 07:41:41 -0400 Date: Sat, 28 Mar 2015 12:41:38 +0100 From: Peter Zijlstra To: Viresh Kumar Cc: Christoph Lameter , Andrew Morton , Johannes Weiner , Linaro Kernel Mailman List , Linux Kernel Mailing List , vinmenon@codeaurora.org, shashim@codeaurora.org, Michal Hocko , Mel Gorman , dave@stgolabs.net, Konstantin Khlebnikov , Linux Memory Management List , Suresh Siddha , Thomas Gleixner Subject: Re: [RFC] vmstat: Avoid waking up idle-cpu to service shepherd work Message-ID: <20150328114138.GI27490@worktop.programming.kicks-ass.net> References: <359c926bc85cdf79650e39f2344c2083002545bb.1427347966.git.viresh.kumar@linaro.org> <20150326131822.fce6609efdd85b89ceb3f61c@linux-foundation.org> <20150327091613.GE27490@worktop.programming.kicks-ass.net> <20150327093023.GA32047@worktop.ger.corp.intel.com> <20150327120240.GC23123@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 28, 2015 at 09:58:38AM +0530, Viresh Kumar wrote: > On 27 March 2015 at 17:32, Peter Zijlstra wrote: > > What's not clear to me is why that thing is allocated at all, AFAICT > > something like: > > > > static DEFINE_PER_CPU(struct tvec_base, tvec_bases); > > > > Should do the right thing and be much simpler. > > Does this comment from timers.c answers your query ? > > /* > * This is for the boot CPU - we use compile-time > * static initialisation because per-cpu memory isn't > * ready yet and because the memory allocators are not > * initialised either. > */ No. The reason is because __TIMER_INITIALIZER() needs to set ->base to a valid pointer and we cannot get a compile time pointer to per-cpu entries because we don't know where we'll map the section, even for the boot cpu. This in turn means we need that boot_tvec_bases thing. Now the reason we need to set ->base to a valid pointer is because we've made NULL special. Arguably we could create another special pointer, but since that's init time only we get to add code for that will 'never' be used, more special cases. Its all a bit of a bother, but it makes sense.