From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50C7235B63C for ; Thu, 19 Mar 2026 10:27:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773916036; cv=none; b=PlqUuUsNxCZZp2iclmtFZiM+87a3Qx1ZDInD2njdIWyqvDXLEmhLSKu6q8Z13jtfHnGflwADAj/HlO/uPY+PTsEhwfrWNCr80BXflyxHsIQIUGD16dRzobp0psELidet58pFQJsQKyTiXlKJCPBetmgkLKrZvyCdCt+KKm/7VS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773916036; c=relaxed/simple; bh=Uh2r5nMB5hAEe1oLgAi+pZ9Dsy5qVgVX7F7ldtvhL14=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dRqjzSONeo6k7S/KEpebL8A8XKPRHHx6ZHmwCt4iq9VmOYKb7Ow5FkYwV7E9FRS7WCgycZAUr4Ojg9zHKGi/FR8re3A1j/k8Ib06Xa/NH653jf/XuVJpgOJCNeKp4sWnjCfbP8uEiiuvL8yx2DghWUeY40WBDeTkvjmhNhREoyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ew40xgvB; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ew40xgvB" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=PvyBuIS1D4oDG3eQTdOKi49ZQOnGQKdbQCKsPTLsrpM=; b=ew40xgvB8qWU3GuRNDgz+aiVrI q5EVsbZ/h/YFWMGV8SYDhmOiPQOKkcoIOo+Fwp8GJJhCZNyeid84Xq+ahpArYdZC5uWYmW1ituku0 RKPsugWd/hvs3dczFwHoNuuYG9hJgKBSZtNH5jlK/HNzRdOhCYs3Vo/VjsacijRgZ0QCFE3nU9hjV fXM51/8JVQQI5dOgNXLY9L2b6wOzm9sGXrtXAl6cd80yWd73fdlN9SLig77qq2/AWQT9BXAKepCuK 4BUZ72WDTVeh6VGaxqti/QFsjNm5HSPfoCEOAGP8FoMviKT4YTe8jB8Dz37aFClHo5Mmq2/zIW2pp e7d2E+Xw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w3Aae-00000005wTz-0dR5; Thu, 19 Mar 2026 10:26:56 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 116FB300578; Thu, 19 Mar 2026 11:26:55 +0100 (CET) Date: Thu, 19 Mar 2026 11:26:55 +0100 From: Peter Zijlstra To: Uros Bizjak Cc: Tejun Heo , Xuewen Yan , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, lukasz.luba@arm.com, linux-kernel@vger.kernel.org, rui.zhang@intel.com, di.shen@unisoc.com, ke.wang@unisoc.com, xuewen.yan94@gmail.com, Marco Elver Subject: Re: [RFC PATCH] sched: Add scx_cpuperf_target in sched_cpu_util() Message-ID: <20260319102655.GF3738786@noisy.programming.kicks-ass.net> References: <20260318121755.16354-1-xuewen.yan@unisoc.com> <20260318124718.GC3738786@noisy.programming.kicks-ass.net> <20260319090240.GS3738010@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Mar 19, 2026 at 11:01:03AM +0100, Uros Bizjak wrote: > On Thu, Mar 19, 2026 at 10:02 AM Peter Zijlstra wrote: > > > That fastpath is definitely better; the slowpath is worse, but that is > > in part because the compilers are stupid and cannot eliminate > > static_branch(). > > asm gotos are implicitly volatile because they are control flow > primitives. The compiler will *not* remove them. Yes, but I want ponies ;-) if (static_branch_unlikely(&foo)) { if (static_branch_unlikely(&foo)) { /* A */ } else { /* B */ } /* C */ } Is a very common occurence. And we all know this really should be: if (static_branch_unlikely(&foo)) { /* A */ /* C */ } So how can we make this happen? IMO marking those functions __const should tell the compiler that yes, it can elimintate them. You should not try and protect the user. If they use __const incorrectly, they get to keep the pieces and all that.