From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.7 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796167921; b=S6BJ+QVcwab9IcPphwV9Cv9n5Yisc6w2D8woFwFj6AW/WWKHp0U4rmL0qBhidpfQ+cGJ g24Zm4L1rOxAmRZ6gsv7YDPnmZ9mPp98yaVOdq2MGlKQTmTmh8ISCxunILGsU2xTC/dAC isrn5VyjKy+W6lYUJ2OYRkrntkHY4hnyDyAeJXLaFA7pXDJh+nNFdlbjx0gqqDqxe0ExF WluKAZern9svUcV3A2uFj6dP5iRuoNP1+JzJFa+CdH/V91fx5oVoa7PFTqTVEszaaA/LQ vSWIGFrG8YuSLOd0lvCUoMNl7wE1Vyv+kksisfQQTGyDnRExrlPoQgkPLQbOootCENQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796167921; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Subject: From:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:MIME-Version; bh=q0Z4MrFgEbHreIRcVlSKpkVg5yyO4xlF27OjeaGfKrM=; b=l+DkbxYDdNckICygTVPxUtrLNNYUxCL90wfM3+Ivanh8Fx1gJPccZt1cwkEsMmz0LTWX 3NJphQYkpl03zfORsPG19UJOYyZ+P6pR2nVzVEKMrAytXoe9y4lgxSidZNladWGXeWhJA QuZpQE2qrIYUUzm2W/u8Rb5mayXzdEqQjdvLXbrdRg0jKwYJSKKhGzSTRrmbDnciD++CB fOWsApJXFJdNr4FOZW3+3HKPJVETAfXt0g2yBsSeJkfYNTDKMj3ZRakJDHcs5eYg9Ym0C YoETIlUWtOPS9RBikuGwtT+8wyEUzQVL6UMOO1W6M/Z59DNu6k80+DqEH+IEbjK7BeA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Tc9uyDSh; arc=none smtp.remote-ip=192.198.163.7 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 859CC606A332; Tue, 1 Dec 2026 23:32:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 859CC606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Tc9uyDSh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796167921; x=1827703921; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=q0Z4MrFgEbHreIRcVlSKpkVg5yyO4xlF27OjeaGfKrM=; b=Tc9uyDShb8Xz5XzTTQ9N+6U7flnWhEdGIJd7qt4MCHjk3GYJXQ2GP1iK gP8gL9A3v7mpZ55s0RbaII8YDYndn7Gh7r0hQ6uZMx3q5hgkHS6wuq0i7 htyeGZ8dZPpnPamBFJQONerUbFFVkcV9zeo2H7aKp9vfq3q3YbPn+AfPD HXzKanEe8GjgDHywuEG8PgcfPujXPsgb2jJGdKWI7MK61tefHTi3eyEMg H4qkMv2G3ep9DbNAev3VvPFDCmPX0UJS9AvW2N7Ni1SGu50rpyiQlzTUq ldVsQz1DocJig/kqKsPO6OQ6I6R/OF3DFXMNfSLP5d4t1Xzr6406HIGGo g==; X-CSE-ConnectionGUID: NTX6ZdIAR3ibqP7O/1Qbbg== X-CSE-MsgGUID: vqfsPJy5TCifY7/ZxOnE7g== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="4913070" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="4913070" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 15:32:00 -0800 X-CSE-ConnectionGUID: NNgInjI9QMynRritDxFSxQ== X-CSE-MsgGUID: VQFUojtEQNOxKuKbaN6ljA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13240952" Received: from unknown (HELO [10.241.243.28]) ([10.241.243.28]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 15:31:59 -0800 Message-ID: <3aae2e10d163775fa43490757cae20ee14e509e3.camel@linux.intel.com> Subject: Re: [PATCH 1/2] Documentation/scheduler: Add cache aware scheduling documentation From: Tim Chen To: Shrikanth Hegde , Peter Zijlstra , Ingo Molnar , Jonathan Corbet Cc: Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Chen Yu , Jemmy Wong , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 01 Dec 2026 15:31:59 -0800 In-Reply-To: <7dd698a5-cbf6-446c-91ce-f026b46a6e18@linux.ibm.com> References: <50a8055e38958cdc39e07435aaad56e4719b2bd3.1794507151.git.tim.c.chen@linux.intel.com> <7dd698a5-cbf6-446c-91ce-f026b46a6e18@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Tue, 2026-12-01 at 23:27 +0530, Shrikanth Hegde wrote: > Hi tim, A few nits. >=20 Shrikanth, Thanks for your review, much appreciated. > >=20 > > diff --git a/Documentation/scheduler/index.rst b/Documentation/schedule= r/index.rst > > index 791178ac8bec..67cf466a169b 100644 > > --- a/Documentation/scheduler/index.rst > > +++ b/Documentation/scheduler/index.rst > > @@ -16,6 +16,7 @@ Scheduler > > sched-domains > > sched-capacity > > sched-energy > > + sched-cache > > schedutil > > sched-util-clamp > > sched-nice-design >=20 > Should the new entry be added at the end? I don't think the above is sort= ed. Right, the list is not sorted. I put it after sched-domains, sched-capacity and sched-energy on purpose, because those are the other topology related documents and sched-cache.rst refers to the same concepts. I would prefer to keep it there, but I don't feel strongly about it. I can move it to the end if you or Jon prefer. >=20 > > + > > +5. When the preference is withdrawn > > +----------------------------------- > > + > > +The preferred LLC of a cache group is cleared (grp->cpu =3D -1) if any= of the > > +following conditions holds. The tasks of the group are then balanced l= ike > > +any other task. > > + > > + (a) The group has not been scanned for more than epoch_affinity_time= out > > + epochs (by default 5 epochs, about 50 ms). The data is stale, be= cause > > + the group became idle or its behavior changed. > > + > > + (b) Too many threads run at the same time. The check is:: > > + > > + fits_capacity(nr_running_avg * SMT_threads, scale * llc_cpus) > > + >=20 > Should this be fits_llc_nr to better match the code? > Also capacity always perceived as multiple of 1024, whereas here it is > number of threads. >=20 The doc was written against v7.4-rc1. Yes, fits_llc_nr has been introduced since. I will rebase and change this to: fits_llc_nr(nr_running_avg * SMT_threads, scale * llc_cpus) and describe the limit as a thread count (the running threads must stay below 80% of the LLC's CPUs) instead of a capacity margin. > > + where llc_cpus is the number of CPUs in the LLC, SMT_threads is = the > > + number of hardware threads per core, and scale is derived from > > + aggr_tolerance (see Section 7.2). fits_capacity() keeps a ~20% m= argin. > > + For an LLC of 16 CPUs with SMT-2 and the default aggr_tolerance,= at > > + most 6 threads can run at the same time. > > + > > +Example 3. > > + The tables below show the decisions with the default values > > + (overaggr_pct =3D 50, imb_pct =3D 20, SMT system). The values are = the LLC > > + utilizations after the move, as a percentage of LLC capacity. > > + > > + Moving toward the preferred LLC (dst is the preferred LLC):: > > + > > + src \ dst 30% 45% 50% 60% > > + 30% Y Y N N > > + 45% Y Y Y N > > + 50% Y Y G G > > + 60% Y Y G G > > + > > + Moving out of the preferred LLC (src is the preferred LLC):: > > + > > + src \ dst 30% 45% 50% 60% > > + 30% N N N N > > + 45% N N N N > > + 50% Y N G G > > + 60% Y Y G G > > + > > + A task can move from a 45% LLC into its preferred LLC that becomes= 50% > > + busy, because 50% is within 20% of 45%. But a task in a 50% busy > > + preferred LLC is not moved out to a 45% busy LLC, for the same rea= son. > > + If it was, the next balance would move it back and cause ping-pong > > + migrations. A task cannot move from a 30% LLC into its preferred L= LC > > + that becomes 50% busy, because 50% is more than 20% above 30%. > > + >=20 > Maybe worth explaining the 45%->60% field as well. Sure. I take it you mean the N in the first table, next to the Y for 45% -> 50%. I will add: A task also cannot move from a 45% LLC into its preferred LLC that becomes 60% busy, because 60% is more than 20% above 45% (45% * 1.2 =3D 54%). >=20 > > + The code compares absolute utilizations, not percentages. The tabl= es > > + assume that both LLCs have the same capacity. > > + > > + > > +8.3 - Cache size information > > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > + > > +The LLC size is read from the generic cacheinfo framework. Architectur= es > > +that do not populate it (currently PowerPC, which has its own cacheinf= o > > +implementation) report an LLC size of 0. When NUMA balancing is active= , > > +any non-zero footprint then fails the check of Section 5 (c), so cache > > +aware scheduling is effectively disabled on these platforms. >=20 > Hopefully below should help. >=20 > https://lore.kernel.org/all/20261127152242.306333-1-sshegde@linux.ibm.com= /#t Thanks, moving powerpc to the generic cacheinfo is the right fix. I will drop the mention of PowerPC from this paragraph and keep only the general statement, so the document does not become stale when your series is merged. >=20 > > + > > +8.4 - NUMA balancing > > +^^^^^^^^^^^^^^^^^^^^ > > + > > +The footprint estimate of Section 5 (c) comes from NUMA balancing faul= t > > +statistics. Without NUMA balancing, the footprint check is skipped, an= d > > +groups with a working set much larger than one LLC can still be aggreg= ated. > > +With NUMA balancing, the scan is also limited to the relevant nodes, w= hich > > +reduces its cost on large systems. > > + > > +8.5 - Multithreading (SMT) > > +^^^^^^^^^^^^^^^^^^^^^^^^^^ > > + > > +The thread limit of Section 5 (b) multiplies the number of running thr= eads > > +by the number of hardware threads per core. Thus, it effectively count= s > > +cores. On systems with many threads per core and small LLCs (for examp= le > > +SMT-4 with 4 CPUs per LLC), almost every multi-threaded process fails = this > > +check unless aggr_tolerance is raised. >=20 > Due to above restriction is there a merit in adding a "status" debugfs en= try > either per-proc or in llc_balancing where it indicates if the llc_balanci= ng is > effectively disabled due to above HW limitations. I agree that it is hard to tell today why a process is not aggregated. The cases are a bit different though: - No sched domain partition spans more than one LLC. This is a global state. It is only reported in dmesg with sched_verbose today, and reading "enabled" returns what the user asked for, not what is in effect. A read-only file in llc_balancing/ could show it. - llc_bytes is 0. This is per LLC domain, so it would fit better in the per domain debugfs directory. Your cacheinfo series should remove the main case anyway. - The SMT / LLC size limit above. This is not really a hardware state. It depends on nr_running_avg of each process and on aggr_tolerance, so a global file cannot report it. It would need something per process. This is a code change, so I would like to keep it out of this documentation series for now and look at it as a follow-up. Tim