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 020B030214C for ; Wed, 10 Dec 2025 09:43:15 +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=1765359798; cv=none; b=sMT+R09UePTfN0HLSSLOJT1eWCzaJw0iMR4joa/XLVwmbNkYLn1GHmAPaazfhHiRHIlkaGGYx/sklWBbPI1ORvzxnEF8KGXdMaemUGO8lknd0avmOVbD5QEhkLlLfpaYPSomemRuB+l87zbm9eBkpDmchKhMk+GCAQtmlOEeXrc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765359798; c=relaxed/simple; bh=FuVXJcxjvsCWLmyYpxcBOLAjwwTSx0ExOZETlI+jO/0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jDgsgnfEJ1i9LQLq/3ru6Bk1tBhEmRpke9Sq/a52LakKDd/HfZoOkwztNZAOCANYc2r3AOdKz71ymF8dcVoX8MrPdvDodDpakHFLbKDVPoViqTvCcy/0nhb9CS+0PBOcQU631JldbfCWRle3ZIgW7sZiDqPtI+XeeXuEaJZS2bo= 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=ioYKYrEu; 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="ioYKYrEu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=aobnHs1NoseOSE4IyJjKTjQhjyP78eICdaybg2lgbec=; b=ioYKYrEuWEflTVTAnlEdsvY9RV 1kYJHWAg90f1xLMSgkcbMTVS5NX29DmWUfK0Bjm1098AhuskO/m+RYxCrsb/TgUREMk/Yru/cUW6Y kZwIDpO9Nylfo6xJDkB3kKET69/J+BwwDkZldQ8Yie5zkJXQuG0mtMiypKswQWykovUckgN9GEYrQ HhT14Ev8oJOAzk2oMerrQyuhhashQmWZd7zGIVnnjV/i3+F7OC6A/xKubfhOq27lNT1Kubi0+7yL7 0D8LA5kVyJaC5TJ0SBO6DFmlicQ2dCOPLx5ulgWnsM3luMI3Pb41ISSkO02CXnwNAHN1+UXY/yGOk LE64kYQg==; 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 1vTGic-0000000CfVE-2cVs; Wed, 10 Dec 2025 09:42:46 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2D09B302EC2; Wed, 10 Dec 2025 10:42:46 +0100 (CET) Date: Wed, 10 Dec 2025 10:42:46 +0100 From: Peter Zijlstra To: Tim Chen Cc: Ingo Molnar , K Prateek Nayak , "Gautham R . Shenoy" , Vincent Guittot , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Madadi Vineeth Reddy , Hillf Danton , Shrikanth Hegde , Jianyong Wu , Yangyu Chen , Tingyin Duan , Vern Hao , Vern Hao , Len Brown , Aubrey Li , Zhao Liu , Chen Yu , Chen Yu , Adam Li , Aaron Lu , Tim Chen , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 06/23] sched/cache: Track LLC-preferred tasks per runqueue Message-ID: <20251210094246.GQ3707891@noisy.programming.kicks-ass.net> References: <20251209121617.GN3707891@noisy.programming.kicks-ass.net> <88cc1be4cbcab6d52172cbbf74fdd063c5e93d98.camel@linux.intel.com> 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: <88cc1be4cbcab6d52172cbbf74fdd063c5e93d98.camel@linux.intel.com> On Tue, Dec 09, 2025 at 02:55:21PM -0800, Tim Chen wrote: > > > +static void account_llc_dequeue(struct rq *rq, struct task_struct *p) > > > +{ > > > + int pref_llc; > > > + > > > + /* > > > + * Borrow the uc_se->active from uclamp_rq_inc_id(), > > > + * uclamp_rq_dec_id() to avoid the unbalanced calculation > > > + * of rq statistics. > > > + */ > > > + if (unlikely(!p->sched_llc_active)) > > > + return; > > > > Another very confusing comment; what? Also, can you please explain (in > > the new comment) how we get here without having llc_active set? > > The comment meant to say that we are using a similar mechanism as > accounting done in uc_se->active from uclamp_rq_inc_id(). I agree that > it confuses more than making things clearer. > > How about the following comment to make things clearer: > > /* > * Cache aware scheduling was active when the task was enqueued. > * Admin has disabled cache aware scheduling before task was dequeued > * but the accounting has to be kept straight in case cache aware scheduling > * is re-enabled. > */ Is having that sched_cache_enabled() test worth it? account_numa_{en,de}queue() don't seem to have any of this. > > > + pref_llc = p->preferred_llc; > > > + if (pref_llc < 0) > > > + return; > > > + > > > + rq->nr_llc_running--; > > > + rq->nr_pref_llc_running -= (pref_llc == task_llc(p)); > > > + p->sched_llc_active = false; > > > +}