From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754052AbdKFQZk (ORCPT ); Mon, 6 Nov 2017 11:25:40 -0500 Received: from merlin.infradead.org ([205.233.59.134]:45500 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753602AbdKFQZj (ORCPT ); Mon, 6 Nov 2017 11:25:39 -0500 Date: Mon, 6 Nov 2017 17:25:34 +0100 From: Peter Zijlstra To: Kirill Tkhai Cc: mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] sched: Account per task_group nr_iowait Message-ID: <20171106162534.GE3857@worktop> References: <150997831079.4082.2128628793286090861.stgit@localhost.localdomain> <150997923220.4082.7025655919924328239.stgit@localhost.localdomain> <20171106160621.GK3165@worktop.lehotels.local> <0ecdcd5d-0b09-2ee8-6570-5910af93d9dc@virtuozzo.com> <20171106162436.GL3165@worktop.lehotels.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171106162436.GL3165@worktop.lehotels.local> 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, Nov 06, 2017 at 05:24:36PM +0100, Peter Zijlstra wrote: > On Mon, Nov 06, 2017 at 07:12:58PM +0300, Kirill Tkhai wrote: > > > >> + atomic_inc(&tg->stat[rq->cpu].nr_iowait); > > > > > > You're joking right, more atomic ops on the fast paths.. > > > > There should be a synchronization... It's modified under rq->lock everywhere, except try_to_wakeup(). > > Would it be better to use one more rq->lock at try_to_wakeup() instead of atomic? > > No, of course not. We spend a lot of time getting of that rq->lock ^ rid > there. > > The better option is to not care about iowait, since its a complete > garbage number to begin with -- read that commit I pointed you to. > > But if you do manage to convince me iowait is a sane thing to export > (and its not); then you should not use atomics -- nor is there any need > to. Since all you want to export is \Sum nr_iowait, you can inc/dec to > pure cpu local variables and the sum will make it all work. > > The extant iowait crap cannot do this because it thinks per-cpu IO-wait > is a thing -- its not, its a random number at best, but its ABI so we > can't fix :-(