From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mundt Date: Wed, 27 May 2009 00:26:15 +0000 Subject: Re: [PATCH] sched: Support current clocksource handling in fallback sched_clock(). Message-Id: <20090527002615.GA8845@linux-sh.org> List-Id: References: <20090526061532.GD9188@linux-sh.org> <63386a3d0905260731m655bfee3q82a6f52d71fa3cef@mail.gmail.com> <1243348681.23657.14.camel@twins> <20090526230855.GA27218@linux-sh.org> <1243380303.3275.40.camel@localhost> <20090526234425.GB6295@linux-sh.org> <1243383730.3275.53.camel@localhost> In-Reply-To: <1243383730.3275.53.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: john stultz Cc: Thomas Gleixner , Peter Zijlstra , Linus Walleij , Ingo Molnar , Andrew Victor , Haavard Skinnemoen , Andrew Morton , linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk On Tue, May 26, 2009 at 05:22:10PM -0700, john stultz wrote: > On Wed, 2009-05-27 at 08:44 +0900, Paul Mundt wrote: > > What would you recommend instead? We do not want to spin here, and if we > > are in the middle of changing clocksources and returning jiffies anyways, > > then this same issue pops up in the current sched_clock() implementation > > regardless of whether we are testing for lock contention or not. > > Likewise, even if we were to spin, the same situation exists if the new > > clocksource does not have the _SCHED_CLOCK bit set and we have to fall > > back on jiffies anyways, doesn't it? > > > > Put another way, and unless I'm missing something obvious, if we ignore > > my changes to sched_clock(), how is your concern not applicable to case > > where we are changing clocksources and using generic sched_clock() as it > > is today? > > Well, Thomas' point that locking isn't necessary, as sched_clock() > doesn't have to be correct, is probably right. > > So, I think a get_sched_clocksource() interface would be ideal (if we > want to get academic at a later date, the pointer could be atomically > updated, and we'd keep it valid for some time via an rcu like method). > > Additionally, you can set the jiffies clocksource as a _SCHED_CLOCK > clocksource and drop the jiffies fallback code completely. > I thought about that initially as well, but in the case of the jiffies clocksource, that won't handle INITIAL_JIFFIES, which we want to subtract to make printk times sane.