From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.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 C380A212542 for ; Tue, 4 Aug 2026 00:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785802232; cv=none; b=njMC+VXPzJiAwIV93iVU3qbXezSEXOiQIRv8vyQtmB1UW+s1dmeCBBqRKpQNdxoughQ0vRtJrHfxdjdoxpLvpJBiyL7UQ6XfPRSqmkv60GfKje9GBYfH08Lna3atgt20SeYc+eRsLMouttik5ho5gTl2sqFBAzzlrRc1qD9TJlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785802232; c=relaxed/simple; bh=CQhwrVy6lh0tzxVHNYYbB6VK0mrF+UzSvXauy3147t8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=k2sElwaGbpcUBv15Jq6d2OWhnn65W6zleWLN9KLhdkR0Gt8xlFObKlBzdPosjHfrjVnVT9BUkRgA5W4svDtpv9jODYWpii1gPspY4QiUlmeHHsHvykhf1LRVgCdqKd4L2Kqj5wDOva5Cm53GbLHQTM1dsckYxDP/wkOSIWjalgU= 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=St6J1lz5; arc=none smtp.client-ip=198.175.65.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="St6J1lz5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785802230; x=1817338230; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=CQhwrVy6lh0tzxVHNYYbB6VK0mrF+UzSvXauy3147t8=; b=St6J1lz59lu2MEPMV5Ji4hd3VxISIRgo/Z7Pyp7sOKxrJJhgNpFfkMQv RLr0jWA7ZK6uAdRSUf3aKe2dida7iyGHrWfIXzhZLMT2WCVk3Bau3zd/6 sLMmy3wQuQ04H5R8tB8diiIRBbVmDLr405Iq/jWWyF1lr5iIe5aF4XDrT WY1ILZwkBu9PaFQGtIDWHmkkmX9uqUprES/Kahhq5Ie+ixWWzIM4od01d VtzvJRmG769+pcKOZcxRvqiQDIpWkb03d1lBqPIlJWg7a49NAVmQrKcSP kbH23jZp8Nxo1vuRHtFv29MA85cspagFZny6HmLhsSw1KOsa+qkSCMxPS g==; X-CSE-ConnectionGUID: C1ieKl/ET1qSnN5B5KQOcQ== X-CSE-MsgGUID: WFxTlCYOS4KJGvLvL7Oeaw== X-IronPort-AV: E=McAfee;i="6800,10657,11864"; a="97503697" X-IronPort-AV: E=Sophos;i="6.25,203,1779174000"; d="scan'208";a="97503697" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2026 17:10:30 -0700 X-CSE-ConnectionGUID: +wn805uaQnyhEK9mlu+5aw== X-CSE-MsgGUID: ZS8b92h0RwO7pajHUJvQ4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,203,1779174000"; d="scan'208";a="258694435" Received: from schen9-mobl4.amr.corp.intel.com (HELO [10.125.108.197]) ([10.125.108.197]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2026 17:10:28 -0700 Message-ID: Subject: Re: [PATCH] sched/cache: honor migrate_llc_task semantics in active load balance From: Tim Chen To: Lu Wang , yu.c.chen@intel.com Cc: peterz@infradead.org, 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, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, chen.yu@linux.dev Date: Mon, 03 Aug 2026 17:10:26 -0700 In-Reply-To: <20260803100227.2585560-1-wanglu.priv@gmail.com> References: <20260803100227.2585560-1-wanglu.priv@gmail.com> 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 Mon, 2026-08-03 at 18:02 +0800, Lu Wang wrote: > Thanks for the review, Chenyu. >=20 > I got interested in CAS because it strikes a good balance between > generic CFS load balancing and strict LLC/CPU affinity. >=20 > My understanding is that migrate_llc_task encodes the target > direction of the balance pass, not just "ALB was triggered by CAS". > alb_break_llc() only vetoes ALB when every task on src_rq prefers > staying put (nr_pref_llc_running =3D=3D cfs.h_nr_runnable); once tasks > have mixed preferences it lets ALB through without checking which > one gets picked. active_load_balance_cpu_stop() then walks > src_rq->cfs_tasks in reverse and takes the first task accepted by > can_migrate_task() =E2=80=94 with multiple tasks on src_rq, that's not > necessarily the one whose preferred_llc matches the destination. >=20 > My patch threads migration_type through to the stopper and, only > for migrate_llc_task, rejects a candidate whose preferred_llc > doesn't match the destination LLC. >=20 > Regarding: > > this helps the case where the task is the only running one on the > > src_cpu >=20 > If that single task already prefers the destination LLC, my check > still returns true, so this case is unaffected. The disagreement is > really about what happens when it does not prefer the destination. > That comes down to how we read the semantics of migrate_llc_task: >=20 > (a) "migrate a task toward the destination LLC selected by > calculate_imbalance()", or > (b) "this ALB was triggered by CAS's LLC-balance logic, so any > generally-eligible task on src_rq may be pushed" The policy of when to break LLC preference locality whether it is in regula= r load balance or in active load balance are both encoded in can_migrate_llc(). Sometimes when an LLC is overloaded, you may want to move the task off its preferred LLC. Moving a task off its preferred LLC is not always wrong. Looks like you patch stop that with migrate_llc_task_wrong_dst(). =C2=A0 There is a comment section above can_migrate_llc() to explain the policy details. Tim >=20 > If (a), the per-task check is needed. >=20 > Happy to discuss further.