Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp364987lqh; Tue, 7 May 2024 01:08:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIlUgBiJh+8+Kn4FOXo5bZvW8JFR2+/mooDZBBLm0g0OH86o8URyMFVpUY2F0W6RaV6qmy3cbkKVguWR2gGv5IO4odwU979I4MkgS4Ow== X-Google-Smtp-Source: AGHT+IGzaZAe7CIwBvaXSJSSFjdczmQst4WJwyGaEU/JmZa1g0HNnduPr7OCM2M/WMPBV2f92k70 X-Received: by 2002:a17:902:e5cb:b0:1e2:c8f9:4cd7 with SMTP id u11-20020a170902e5cb00b001e2c8f94cd7mr12763056plf.64.1715069331381; Tue, 07 May 2024 01:08:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715069331; cv=pass; d=google.com; s=arc-20160816; b=sSzodhDnb8V0I14cXDPO61uFotAuweCLAv2aUY7Z3ev6dxCGQEnF/DVHPXqc3me7O7 rSOSl5yftw7dbpu9FFaz2BF42Tzxm/DOBv6AybFTCsl87m59ENllf0WU49dgOmV2nO5O 2hxQ6iOxEirbrCApar1U1sOLtOz7kGDaISM5TlGteeBWF/yk04n9ptGMWx/wtU1jJ7Qu 8uGO7uUWq0NH+hfw3mUOfyM9xGzQZSYdOi/Ca09T9MYYANSda+iwulpOxSFiYz2OjkaH +cSMiacoEKT5l1aPLBelrLosGDs1UNEUgOAeRYfby1AsSNSqkEIjSjEN+mtOp9wcqXNY HAWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mwrUGiZ0asXgwHyY2TVTmTc3sgOxDoElawtH7VwSdAg=; fh=8TI8d9KpTq9Bv5i1NZMgFvrSzGExbT+PoSxjGmihqJU=; b=Sb1P+NpY8NTVCD+VBh5IDd13mIUJyDZ+qBiaKf/2A4ZTMVVGO82cSeAk8Wf5ltB/kj SvAb46HsGBgt5zRYyYG2k+sOXgrJrpBBpeUPaHmhooq45OcEUMzZsZ5/8vW16gqnrDu8 ZB/ZMAzbQ3/E0hav37RC96/FkI8BJp4ALph8GhGdxez+Lt03y5ZhchjfxGpnEzKi1rLL WCZMLxyPt7HU+CyRdvzuKfGb6LZv9hj5Lkh6Z7v4o6MqK19rKPpXaJv9VSd3YXEHi47Q 8x0BbrVDagMUqhpwky+bMJbwEUqeqyVpR14r2KTDb5UfOEWPc20aBolpniYyq+IWAQb0 qXeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=dxMNaAMh; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-170853-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170853-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lv14-20020a1709032a8e00b001ee1fcfe1a4si3139353plb.379.2024.05.07.01.08.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 01:08:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170853-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=dxMNaAMh; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-170853-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170853-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E0A8628408E for ; Tue, 7 May 2024 08:08:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E0FA13C8F7; Tue, 7 May 2024 08:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dxMNaAMh" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 45D3113C667; Tue, 7 May 2024 08:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715069314; cv=none; b=PVydSUl5oZY1tDdh3iMKK4omPy1ApwfUED7n+0+jX8Z4/bCIz1N+eGjPVhcyH2Xr6+BdAficLIQVtr9EpaLTVyTr5m8A36PslsLJpOIvl0nrq1Yos+C8hcFo2r0+8E6B57QRbLFIwiVMqufeBGAODvKRsT7i1eamnCC20HfOjdo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715069314; c=relaxed/simple; bh=EWayG2dooI4l80D4YPv+uZuesHLcm/Cr3UnEsBDEcYQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BMNVv5mInEUMbuXvNSG18BOZpdeI46QCN2ytbibjZlH3WAs9xyFdQ2sVN/IhdiAdovv4lSao9+Xvkq34hS9N0s7k3wFd3F3yzxWCeELYwVjI9rxSfTFnoQsYnVsheqzSkXJ3SFOg35u4xuy7otRplopH9w7vGaukzmXvj5y0Bt4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (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=dxMNaAMh; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=mwrUGiZ0asXgwHyY2TVTmTc3sgOxDoElawtH7VwSdAg=; b=dxMNaAMhkKp+u5Tf42Mj3ImcKi OAVk7QxxSNtkMfxBYyMJw7PQ7YrnAd0UXs844ZTpEeKdHGhUL4pKtZTLDqa8xm9G8WVDh+ZQFxdzw oWhpAK5vz++tK0pjvjxAlrGmiKFI0FXTJcsu/B+W3e7ZzdMOnhfmj8FyvcGJHd4eAeHV5KCsRsD+s Peh+iAagKMZzuw0A3kAvI3S9PIJQCF3v9bs3hCVlDMOhwCgQ9Mll1FaO6YK4RcxWf9BU9M7uUrInT nUJhoEdX8TMFD5ZcrmxkG0DLSUovFBpx8iDSNrBNno5t3kU7FWCfS4dGoM2F54w9uDeZJkLAxS4nh CUb9GCow==; Received: from [24.132.130.84] (helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Fmq-0000000218z-1JFp; Tue, 07 May 2024 08:05:02 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 6F9D8300276; Tue, 7 May 2024 10:02:30 +0200 (CEST) Date: Tue, 7 May 2024 10:02:30 +0200 From: Peter Zijlstra To: Qais Yousef Cc: "Rafael J. Wysocki" , Viresh Kumar , Ingo Molnar , Vincent Guittot , Juri Lelli , Steven Rostedt , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Christian Loehle , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sched: Consolidate cpufreq updates Message-ID: <20240507080230.GP40213@noisy.programming.kicks-ass.net> References: <20240505233103.168766-1-qyousef@layalina.io> <20240506100509.GL40213@noisy.programming.kicks-ass.net> <20240507005659.d4rzzaoq3isanndf@airbuntu> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240507005659.d4rzzaoq3isanndf@airbuntu> On Tue, May 07, 2024 at 01:56:59AM +0100, Qais Yousef wrote: > Yes. How about this? Since stopper class appears as RT, we should still check > for this class specifically. Much nicer! > static inline void update_cpufreq_ctx_switch(struct rq *rq, struct task_struct *prev) > { > #ifdef CONFIG_CPU_FREQ > if (likely(fair_policy(current->policy))) { > > if (unlikely(current->in_iowait)) { > cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT | SCHED_CPUFREQ_FORCE_UPDATE); > return; > } > > #ifdef CONFIG_SMP > /* > * Allow cpufreq updates once for every update_load_avg() decay. > */ > if (unlikely(rq->cfs.decayed)) { > rq->cfs.decayed = false; > cpufreq_update_util(rq, 0); > return; > } > #endif > return; > } > > /* > * RT and DL should always send a freq update. But we can do some > * simple checks to avoid it when we know it's not necessary. > */ > if (task_is_realtime(current)) { > if (dl_task(current) && current->dl.flags & SCHED_FLAG_SUGOV) { > /* Ignore sugov kthreads, they're responding to our requests */ > return; > } > > if (rt_task(current) && rt_task(prev)) { doesn't task_is_realtime() impy rt_task() ? Also, this clause still includes DL tasks, is that okay? > #ifdef CONFIG_UCLAMP_TASK > unsigned long curr_uclamp_min = uclamp_eff_value(current, UCLAMP_MIN); > unsigned long prev_uclamp_min = uclamp_eff_value(prev, UCLAMP_MIN); > > if (curr_uclamp_min == prev_uclamp_min) > #endif > return; > } > > #ifdef CONFIG_SMP > if (unlikely(current->sched_class == &stop_sched_class)) > return; > #endif > > cpufreq_update_util(rq, SCHED_CPUFREQ_FORCE_UPDATE); > return; > } > > /* Everything else shouldn't trigger a cpufreq update */ > return; > #endif > }