Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760768AbcDFHuM (ORCPT ); Wed, 6 Apr 2016 03:50:12 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:46927 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760607AbcDFHuI (ORCPT ); Wed, 6 Apr 2016 03:50:08 -0400 Date: Wed, 6 Apr 2016 09:50:00 +0200 From: Peter Zijlstra To: Zhao Lei Cc: "'Ingo Molnar'" , "'Srikar Dronamraju'" , tglx@linutronix.de, efault@gmx.de, htejun@gmail.com, linux-kernel@vger.kernel.org, tj@kernel.org, torvalds@linux-foundation.org, yangds.fnst@cn.fujitsu.com, hpa@zytor.com Subject: Re: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Message-ID: <20160406075000.GF3430@twins.programming.kicks-ass.net> References: <20160404140312.GA28495@linux.vnet.ibm.com> <20160406065436.GB3078@gmail.com> <007901d18fd8$8c1e7810$a45b6830$@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <007901d18fd8$8c1e7810$a45b6830$@cn.fujitsu.com> 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: 411 Lines: 11 On Wed, Apr 06, 2016 at 03:47:18PM +0800, Zhao Lei wrote: > > If you change the above loop to something like: > > > > for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) { > > if (WARN_ON_ONCE(!ca->cpuusage)) > > continue; > > this_cpu_ptr(ca->cpuusage)->usages[index] += cputime; > > Or s/ this_cpu_ptr/get_cpu_var to avoid preempt? This is all called with rq->lock held, preemption is firmly disabled.