Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2662698imu; Fri, 23 Nov 2018 12:42:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/XxWHqBnAGabjeTspEQ8Zs1kyyV309TfXDy74maW7H7xhGKgSL6xr8KBENNagEwrjGQYaAJ X-Received: by 2002:a63:170c:: with SMTP id x12mr15021994pgl.364.1543005744657; Fri, 23 Nov 2018 12:42:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543005744; cv=none; d=google.com; s=arc-20160816; b=l7z9XfrCkTcENMquRJZCFiwfWIdhpoBM196kibxHjgbuTLng6c5ZLMx8u6jYvaELAk 78/+RaPdtlfzhSCkglVqpQ77ghRDHgONEhk4Vl3UGJULO4MsrhGOCoL1GekExk5/6jAd plJRqXJCLy9y7GvgFJBPB9uPQIF9slMSNuuEbAIaVXVnVoZhceMScFbbdDeRZ3mFtNdb NDouDCHV92JSAaQDUrRPWW9l0339TN63d3QtmvweM8QHRtiBPYGms0EjIcNdOh+Sixi0 M0LDu/+7LfWUvcdG9OD0BW2upZ0/b4cbfqPBECO9quQ7mHBysi/iwzl8jTU2s2t8EG2x OSFA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2coVH1rXieRNEyzHlyRPq8jo7BP1K0ZxTXfvuLg6W8M=; b=QgQv9b50aYo1jUsZA244Lwi+GDX+ngdMbVxhbT46Qxsn8WfD2LJEt+FQD/FSXTQcEr 7kVQB6qZYAROGW7qPqgLC/vO1z+Mhe2yFQ2oqYlOMz2/yReMhOfJ33D1qgkQxiXozv9/ 0YGsK6BBF2n+bLv6CXnS/LokcJT5iOkL1hGWKHpQdLeLwjZ+G8f7cW729GDNDvF7HuIZ bWPAPnCg87jX51V+L3Uros//l1UcPi3KjvfDiVwpeh71lQAJAdtGdSI7G5QQ2rdtdgXM Oxz4RAXbO6tG8zbamrl4B3Z1YHWZBUQWPaDLi+EviR3zTK6IHQ/8Fwxt3A5TtnsmyE1T 8Ldw== 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 l8si53084882pgr.345.2018.11.23.12.42.10; Fri, 23 Nov 2018 12:42:24 -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 S2395483AbeKWBA0 (ORCPT + 99 others); Thu, 22 Nov 2018 20:00:26 -0500 Received: from foss.arm.com ([217.140.101.70]:50258 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389042AbeKWBAZ (ORCPT ); Thu, 22 Nov 2018 20:00:25 -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 3B03C36B4; Thu, 22 Nov 2018 06:20:51 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6A4F43F5AF; Thu, 22 Nov 2018 06:20:48 -0800 (PST) Date: Thu, 22 Nov 2018 14:20:45 +0000 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v5 04/15] sched/core: uclamp: add CPU's clamp groups refcounting Message-ID: <20181122142045.GM14309@e110439-lin> References: <20181029183311.29175-1-patrick.bellasi@arm.com> <20181029183311.29175-6-patrick.bellasi@arm.com> <20181111164754.GA3038@worktop> <20181113151127.GA7681@darkstar> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181113151127.GA7681@darkstar> 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 13-Nov 07:11, Patrick Bellasi wrote: > On 11-Nov 17:47, Peter Zijlstra wrote: > > On Mon, Oct 29, 2018 at 06:32:59PM +0000, Patrick Bellasi wrote: [...] > > > + /* Both min and max clamps are MAX aggregated */ > > > + if (max_value < rq->uclamp.group[clamp_id][group_id].value) > > > + max_value = rq->uclamp.group[clamp_id][group_id].value; > > > > max_value = max(max_value, rq->uclamp.group[clamp_id][group_id].value); > > Right, I get used to this pattern to avoid write instructions. > I guess that here, being just a function local variable, we don't > really care much... The above does not work also because we now use bitfields: In file included from ./include/linux/list.h:9:0, from ./include/linux/rculist.h:10, from ./include/linux/pid.h:5, from ./include/linux/sched.h:14, from kernel/sched/sched.h:5, from kernel/sched/core.c:8: kernel/sched/core.c: In function ‘uclamp_cpu_update’: kernel/sched/core.c:867:5: error: ‘typeof’ applied to a bit-field rq->uclamp.group[clamp_id][group_id].value); ^ [...] > > > + if (rq->uclamp.value[clamp_id] < p->uclamp[clamp_id].value) > > > + rq->uclamp.value[clamp_id] = p->uclamp[clamp_id].value; > > > > rq->uclamp.value[clamp_id] = max(rq->uclamp.value[clamp_id], > > p->uclamp[clamp_id].value); > > In this case instead, since we are updating a variable visible from > other CPUs, should not be preferred to avoid assignment when not > required ? And what about this ? > Is the compiler is smart enough to optimize the code above? > ... will check better. Did not really checked what the compiler does in the two cases but, given also the above, for consistency I would probably prefer to keep both max aggregation as originally defined. What do you think ? -- #include Patrick Bellasi