From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934708AbcIETQk (ORCPT ); Mon, 5 Sep 2016 15:16:40 -0400 Received: from merlin.infradead.org ([205.233.59.134]:60498 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932200AbcIETQi (ORCPT ); Mon, 5 Sep 2016 15:16:38 -0400 Date: Mon, 5 Sep 2016 21:16:17 +0200 From: Peter Zijlstra To: Stanislaw Gruszka Cc: linux-kernel@vger.kernel.org, Giovanni Gherdovich , Linus Torvalds , Mel Gorman , Mike Galbraith , Paolo Bonzini , Rik van Riel , Thomas Gleixner , Wanpeng Li , Ingo Molnar Subject: Re: [PATCH v2 1/2] sched/cputime: Use only pi_lock to protect sum_exec_runtime read Message-ID: <20160905191617.GC3318@worktop.controleur.wifipass.org> References: <1473066782-19372-1-git-send-email-sgruszka@redhat.com> <1473066782-19372-2-git-send-email-sgruszka@redhat.com> <20160905141657.GA22190@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160905141657.GA22190@redhat.com> 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 Mon, Sep 05, 2016 at 04:16:57PM +0200, Stanislaw Gruszka wrote: > On Mon, Sep 05, 2016 at 11:13:01AM +0200, Stanislaw Gruszka wrote: > > Currently we protect 64bit sum_exec_runtime read on 32bit cpus using > > task_rq_lock() which internally takes t->pi_lock and rq->lock. Taking > > rq->lock is not needed in this case. > > I looked more at kernel/sched/ code and now I'm not sure about this. > I assumed that update_curr() is called with rq->curr->pi_lock, but > looks like it can be called with some other task->pi_lock not > necessary the rq->curr, hence looks that we need rq->lock to assure > protection Correct, rq->lock needs be held for this. update_curr() is called from places like the tick and schedule(), neither of which hold pi_lock.