Received: by 10.223.185.116 with SMTP id b49csp4977748wrg; Wed, 7 Mar 2018 04:27:43 -0800 (PST) X-Google-Smtp-Source: AG47ELuuGcKpW9FEUgrNZvaqt0/PfhdPG2eXttkpAsFLm0YS8xrbKtgL1k56/lCqrc1Ir8OBzg0E X-Received: by 10.98.202.23 with SMTP id n23mr22541334pfg.52.1520425663268; Wed, 07 Mar 2018 04:27:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520425663; cv=none; d=google.com; s=arc-20160816; b=qIEaSaXKM6mxKDY7NInGUnsPV6ODIe3M4qDOxLyUMjJIjH6WTOEJc+7uh5WpnXDStz NDBN7KPdz+IuB6qLq3pYoDvVK/b3GA+Clc5AYjpv6znOiuKAOAHdaJjxhqD0QSaOE1rA MWxDU7BA7nHoVqoHin28u8BlGfD8mETLUYcgSJXw0TdfbJLhtaXwS+NbzOoi9sUWzZP4 xdb9UwBz6KO/SAcBeZ3zG6m5sIWJnARFLSWRpKgppEou6DuY/EdLpkNmHdrddvqkQHFK YWwVCuDM0mq+4YsogWkf5SFnS741StELh/FGJ3n7rhLz+KsuO7LhvKijhCOD24Yv2juk 6iUg== 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:dkim-signature:arc-authentication-results; bh=d1MntZWGvHiCfZJoazWrUJZs+TmPIQYxwLYXXmOUNM4=; b=ehnME6vxMuptJv7bCbbeAhBzGFQOUvrtF9mz0v0d9k6xE/t/Vnn/yj8aLEvIsOu9iu MW0z8MSvI+h0FtTUrdEiUtUglm13Z8ESllk6aKsV9pzHP07UjdZA7BzNEG3s5rO7j0c+ b/Tpc515W+LT49d5ISvmXLv2VQNxch32atX+g5xbuz76osToIx07znbExgNJRH56C7oX crhd1dhkxg3FmwE8QOYKWbT8O21zSg3j/mwme1B9xKs2xYTNF1w+H5jOg5ES7bDRbtZ2 A7Mqbm4p3/fB4pUXErniYKjI9yWVXn2E2lStrxW6GyDfBtTv3U2jeQuzKgCIAYnJffCF hcOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Rf6FCTLn; 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 m13si11352806pgd.641.2018.03.07.04.27.28; Wed, 07 Mar 2018 04:27:43 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Rf6FCTLn; 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 S932801AbeCGM0U (ORCPT + 99 others); Wed, 7 Mar 2018 07:26:20 -0500 Received: from merlin.infradead.org ([205.233.59.134]:43620 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754392AbeCGM0O (ORCPT ); Wed, 7 Mar 2018 07:26:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=d1MntZWGvHiCfZJoazWrUJZs+TmPIQYxwLYXXmOUNM4=; b=Rf6FCTLnJoPv5SI5f0LN5eRIw kNmDrZ4pWFZvjmkT3cX99/HYg0WhjSbLTggXFR/Ob6C//t6PZkVwg/SfoYvotDm07fj7K8Rs5fKly ZwywmJCu7qq1wiuFhUE8M+Q5DvIEKBNDqC7PxheVFWXHWRTAIvJd4+5pR86k9JMQc8nlYDoInQ8MR gqIktHL79a1gi+jmg30/qX/2O/NKrGN8nekSgisvT1ljRqEL6GoRdEUafSyTlj5rBuh84eUANyuvZ EViA/EXpTL7kXpZNfqEp6ueJzNfDFmPwPV5PoOI1S5axt3ceSvWsdKFBrvD1Xd9bhexGtAMK5YIXG DYb0Fj6kg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1etY92-000453-QN; Wed, 07 Mar 2018 12:26:09 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A46352029FA14; Wed, 7 Mar 2018 13:26:07 +0100 (CET) Date: Wed, 7 Mar 2018 13:26:07 +0100 From: Peter Zijlstra To: Patrick Bellasi 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: <20180307122607.GN25181@hirez.programming.kicks-ass.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180307114711.GB2211@e110439-lin> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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). I suspect it all works as expected... but its a tad tricky.