Received: by 10.223.185.116 with SMTP id b49csp5163548wrg; Wed, 7 Mar 2018 07:19:16 -0800 (PST) X-Google-Smtp-Source: AG47ELu+ZD6vUMZOOp8bQR9myknog3HFPgbZ1ACx6dGaEpATzy4HoQbV7JnMN+FWPJmG7YwtMoYq X-Received: by 2002:a17:902:6b43:: with SMTP id g3-v6mr8911278plt.153.1520435956618; Wed, 07 Mar 2018 07:19:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520435956; cv=none; d=google.com; s=arc-20160816; b=FAuaxe7lMssJbVcHgvn8uRP7n73NXSf6XKuX4QipaUBJBONX7eirE6RAX2HP6kzNDu TtTlVrXDJTT3E54u+tYcLE8DMroh/XM2wcoWvL3lm1oGyD2ljEc8IW9VI34ypFenpH+4 heRST62bObhiRnzgTlMVe1OR1oUilU/R+SDHPAV0PVfZ9N6zfJj/Cp/tguiJqPc14/YP tyk3Ny95CcCnfqVKlxylnmguRoq1hVx0qkKuHmXjQmPsNe8L0UkfP7iFGxkeGVuDq+94 nEL3B568OjnMu5KVFN+1MXL1h8vDnfUi4+TQ1CJm2j1FSEzucJn04/H1B8mJRV5gRXaF +0bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=W0uWf+5LQAIjy5cIsr+rGWCyvYojbzuWJ2E2cLejmhI=; b=MlHDbsLX+bvvNNaaPXZelCvn2xpAsUitOHo4pMLcirxeCbucxitatRnI0RmKZK9ai8 xJjOy1AgfVvExePSWj+aeqdYiIpF2GegGlpqmGSWDrfeABlcX59T45LMNt6ZxfMBlFDH q80GOqX4Jrwtd/1oo7lx2aAOBOKI7g8DTMQ1v5bNLxt6CKsnDENw0gzdvmdtI2K2Gx5y RcUZ+677lHcFnhAXs0sBIscOS8GJSiVsWscry6p85Sye7B3GepCW8LqU3jeXcUDFe/g6 QC8me1NSAfGPzAKtmtm2VEY3yu3FZRb5yJvooLtpw5eInmkTwUptxOG1B4RxJLSGog7H 68mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y67si11473231pgb.728.2018.03.07.07.19.01; Wed, 07 Mar 2018 07:19:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933533AbeCGPQ7 (ORCPT + 99 others); Wed, 7 Mar 2018 10:16:59 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52616 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932448AbeCGPQz (ORCPT ); Wed, 7 Mar 2018 10:16:55 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB5071435; Wed, 7 Mar 2018 07:16:54 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8026B3F53D; Wed, 7 Mar 2018 07:16:52 -0800 (PST) Date: Wed, 7 Mar 2018 15:16:49 +0000 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH v5 1/4] sched/fair: add util_est on top of PELT Message-ID: <20180307151649.GD2211@e110439-lin> References: <20180222170153.673-1-patrick.bellasi@arm.com> <20180222170153.673-2-patrick.bellasi@arm.com> <20180306190241.GH25201@hirez.programming.kicks-ass.net> <20180307114711.GB2211@e110439-lin> <20180307122607.GN25181@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180307122607.GN25181@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07-Mar 13:26, Peter Zijlstra wrote: > On Wed, Mar 07, 2018 at 11:47:11AM +0000, Patrick Bellasi wrote: > > On 06-Mar 20:02, Peter Zijlstra wrote: > > > On Thu, Feb 22, 2018 at 05:01:50PM +0000, Patrick Bellasi wrote: > > > > +struct util_est { > > > > + unsigned int enqueued; > > > > + unsigned int ewma; > > > > +#define UTIL_EST_WEIGHT_SHIFT 2 > > > > +}; > > > > > > > + ue = READ_ONCE(p->se.avg.util_est); > > > > > > > + WRITE_ONCE(p->se.avg.util_est, ue); > > > > > > That is actually quite dodgy... and relies on the fact that we have the > > > 8 byte case in __write_once_size() and __read_once_size() > > > unconditionally. It then further relies on the compiler DTRT for 32bit > > > platforms, which is generating 2 32bit loads/stores. > > > > > > The advantage is of course that it will use single u64 loads/stores > > > where available. > > > > Yes, that's mainly an "optimization" for 64bit targets... but perhaps > > the benefits are negligible. > > > > Do you prefer to keep more "under control" the generated code by using > > two {READ,WRITE}_ONCEs? Any specific preference on this previous point? > > IMO here we can also go with just the WRITE_ONCEs. I don't see a case > > for the compiler to mangle load/store. While the WRITE_ONCE are still > > required to sync with non rq-lock serialized code. > > But... maybe I'm missing something... ? > > I'm not sure we rely on READ/WRITE_ONCE() of 64bit variables on 32bit > targets to be sane anywhere else (we could be, I just dont know). My understating is that, since here we are in an rq-lock protected section, and only in this section we can write these vars, then the load is a dependency for the store and the compiler cannot screw up... > I suspect it all works as expected... but its a tad tricky. Then let's keep them for the time being... meanwhile I try to get some more "internal" feedback before next posting. -- #include Patrick Bellasi