Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754839AbbDONcp (ORCPT ); Wed, 15 Apr 2015 09:32:45 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:43113 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752593AbbDONcg (ORCPT ); Wed, 15 Apr 2015 09:32:36 -0400 Date: Wed, 15 Apr 2015 15:32:11 +0200 From: Peter Zijlstra To: Frederic Weisbecker Cc: Jason Low , Linus Torvalds , Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E. McKenney" , Andrew Morton , Oleg Nesterov , Mike Galbraith , Mel Gorman , Steven Rostedt , Preeti U Murthy , hideaki.kimura@hp.com, Aswin Chandramouleeswaran , Scott J Norton Subject: Re: [PATCH 2/3] sched, timer: Use atomics for thread_group_cputimer to improve scalability Message-ID: <20150415133211.GP23123@twins.programming.kicks-ass.net> References: <1429052986-9420-1-git-send-email-jason.low2@hp.com> <1429052986-9420-3-git-send-email-jason.low2@hp.com> <20150415132534.GB4489@lerouge> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150415132534.GB4489@lerouge> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1547 Lines: 35 On Wed, Apr 15, 2015 at 03:25:36PM +0200, Frederic Weisbecker wrote: > On Tue, Apr 14, 2015 at 04:09:45PM -0700, Jason Low wrote: > > void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times) > > { > > struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; > > struct task_cputime sum; > > > > if (!cputimer->running) { > > /* > > * The POSIX timer interface allows for absolute time expiry > > * values through the TIMER_ABSTIME flag, therefore we have > > + * to synchronize the timer to the clock every time we start it. > > */ > > thread_group_cputime(tsk, &sum); > > + update_gt_cputime(cputimer, &sum); > > + /* Start 'running' after update_gt_cputime() */ > > + smp_store_release(&cputimer->running, 1); > > This barrier should be mirrored somewhere but I can't see where in this patch. > Maybe in another one in the series. Or maybe there is already a barrier in the > existing code that I'm missing. I would expect to see it in account_group_*_time(). > In any case, there should be comment about what it mirrors. I think it should be in cputimer_running(), which should use smp_load_acquire() to read cputimer->running. That way you guarantee that everything observing 'running' will indeed observe the initialized state. -- 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/