From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 0BDEA2F12D3 for ; Tue, 9 Dec 2025 22:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765320927; cv=none; b=AGGAsq6pmpRD5PSdNQK028XCpbCbAmKpjVRazgg4UW3eAu2J6FLTvzkyLrddCGXe9I4z31FXwPQrnoB9NXoOcb86tTZJmxVrIeEe4inxwNZug/eInXo15vjGujvBPXrhkeKy1emLaIgOeu2AYUq7E41rEgRi1AykhS9rlgBl080= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765320927; c=relaxed/simple; bh=DjU1rLs9mIkyo6LAUcItOKfpoOX2TFyXN1qSKYo8s7g=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=L5jnRWwYgl9gHMRoIT/xwge1VmiqUChcPCDl9gD27VQoE10/XOKZ1EKtjPC73Bwylh4ykE3wRL6g+RCCPuPtJwRXaUu1fg7CW7oxuhjT0Fkinqko41RZi1Z56lkrWbK8GizKaet5tOb18uOpWs9q7iy7oQQFMVAX2OsKKPUB+CU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=f4XGA9Bv; arc=none smtp.client-ip=192.198.163.13 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) header.d=intel.com header.i=@intel.com header.b="f4XGA9Bv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765320924; x=1796856924; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=DjU1rLs9mIkyo6LAUcItOKfpoOX2TFyXN1qSKYo8s7g=; b=f4XGA9BvYcfuDe0GXcR/XBp1+VNBdG4xjH229RzYjy1+m3ln89aAYjN/ 0/rEfA4hx7zo79fmWTLS3JIWbos4fGgWBwUfGkE0ZMhpJPqQFRz0xTusK 2dTzayNCQsfLd1d6W0Ij+pS7JSZyYHinDl3TECpwFA5hSHZw7RXMfQsAE 8oy/YJpTQN9/7KvIcj3Mh7+gJeE3peAp6xlZgHjIICnXGOi93NMlq02oh wDdmVYH5YoDvAxCYESeYgYzyusAnJ0MNNqwFDY6+nSqqZSb+c1pUNDqmm 7GZgjkt70bi9R2bQn0inRHWGAdbtmFuymW4kYpwnoKdKYbMGbLckDOdkF Q==; X-CSE-ConnectionGUID: XEbKOtWfSnKlxjpEQ/tNrw== X-CSE-MsgGUID: QwK7kdU7S2aU1LJqxoTA7g== X-IronPort-AV: E=McAfee;i="6800,10657,11637"; a="69877592" X-IronPort-AV: E=Sophos;i="6.20,262,1758610800"; d="scan'208";a="69877592" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2025 14:55:23 -0800 X-CSE-ConnectionGUID: p8TnlCeqQSiqKv3Zq2oBdQ== X-CSE-MsgGUID: QZaXIY+YS76qYMLY8aLuOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,262,1758610800"; d="scan'208";a="196257689" Received: from unknown (HELO [10.241.243.18]) ([10.241.243.18]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2025 14:55:22 -0800 Message-ID: <88cc1be4cbcab6d52172cbbf74fdd063c5e93d98.camel@linux.intel.com> Subject: Re: [PATCH v2 06/23] sched/cache: Track LLC-preferred tasks per runqueue From: Tim Chen To: Peter Zijlstra 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 Date: Tue, 09 Dec 2025 14:55:21 -0800 In-Reply-To: <20251209121617.GN3707891@noisy.programming.kicks-ass.net> References: <20251209121617.GN3707891@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2025-12-09 at 13:16 +0100, Peter Zijlstra wrote: > On Wed, Dec 03, 2025 at 03:07:25PM -0800, Tim Chen wrote: >=20 >=20 > > #ifdef CONFIG_SCHED_CACHE > > struct callback_head cache_work; > > + /*the p is currently refcounted in a rq's preferred llc stats*/ >=20 > Shall we have spaces after and before the comment marks? >=20 > Also, comment confuses me, I don't see get_task_struct() / > put_task_struct() usage. Did you mean something else with refcount? It is the accounting for number of tasks preferring a certain LLC on a runqueue during enqueue/dequeue, or when a task's LLC preference changes, by account_llc_enqueue() and account_llc_dequeue() How about change he comment to /* LLC preference accounting should be done in dequeue */ >=20 > > + bool sched_llc_active; > > int preferred_llc; > > #endif >=20 > > +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; >=20 > 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 scheduli= ng * is re-enabled. */ >=20 > > + > > + pref_llc =3D p->preferred_llc; > > + if (pref_llc < 0) > > + return; > > + > > + rq->nr_llc_running--; > > + rq->nr_pref_llc_running -=3D (pref_llc =3D=3D task_llc(p)); > > + p->sched_llc_active =3D false; > > +}