From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 BFEFA437115 for ; Tue, 4 Aug 2026 08:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.11 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785831455; cv=fail; b=RYFPHR/pKq7crS5qbgjH9wfRcPOYShnt+6qUZtxJw7dA0/ABC1kKEx3nEvb8e3huOJjwErIe30VC2i8cz5RVwhIhehfYcysoDel/dV72x+/cgWlV8aV/J4sur01yxsuKYD2Elq98jpgK4kolx/CXgwHUvembj3aWZi2WOUQLeww= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785831455; c=relaxed/simple; bh=lvzp92NYQXQtlTA00w4hPqpwEuj2WOseTf//qJHmQ24=; h=Message-ID:Date:Subject:To:CC:References:From:In-Reply-To: Content-Type:MIME-Version; b=nsS43eh7zp4Cb+Ky79GM6Cv/X0djN98XYic/spTpIyblt6QFJXDYnXPZCbjXIbsw/Hl9h9gPkhASOCnjs3aS7mBoEX78wlpXL2q5NJeRtqPvJmtFMj4RsAPYCzp3B0JqY9E0xi0Mqbv9J76Az16YTB6ywvsVu+r8RJBm2pLTc0g= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Hp7w43qW; arc=fail smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Hp7w43qW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785831452; x=1817367452; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=lvzp92NYQXQtlTA00w4hPqpwEuj2WOseTf//qJHmQ24=; b=Hp7w43qWznFj5OM/0mK7iXT0R42ruxJpEe9AyyC66E/GHoxSllhToTDa cYUiwENmwiEj2kk8fApqgjTKIWbQfZtqjDrvvGlTStv/mgjsShbO346Z8 OB/2SVo0FQecBWD7QuwxEpM8MGToA54e6OT84YvX2iX90dOCHePdViuN4 cuX3p6TvCd7lVrY6ZPB6CVX34tjwC2OHfpUYVm8YNKhruCKDVtqayMWhw YedQlR2aQyGd95bM9hhk54nT0Ih67O7O72RPVw/sAp/AGE7WaaiPn0uP0 b4fbDAqdONWVBRpHTKNRACub013yA2v+MfyB8lJSpUg+ch4ow7S/siBeN w==; X-CSE-ConnectionGUID: YXx6oD01QA2y+Y1AweSO/Q== X-CSE-MsgGUID: QnMSqdxTTyOIL7LxChkvjA== X-IronPort-AV: E=McAfee;i="6800,10657,11864"; a="96967760" X-IronPort-AV: E=Sophos;i="6.25,204,1779174000"; d="scan'208";a="96967760" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2026 01:17:30 -0700 X-CSE-ConnectionGUID: enuPj64lS0KnQ4i9xSp/Pg== X-CSE-MsgGUID: cbuD6w55RTClW8k4qNQFJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,204,1779174000"; d="scan'208";a="257117670" Received: from orsmsx902.amr.corp.intel.com ([10.22.229.24]) by fmviesa006.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2026 01:17:30 -0700 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) by ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Tue, 4 Aug 2026 01:17:29 -0700 Received: from ORSEDG903.ED.cps.intel.com (10.7.248.13) by ORSMSX903.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45 via Frontend Transport; Tue, 4 Aug 2026 01:17:29 -0700 Received: from BN8PR05CU002.outbound.protection.outlook.com (52.101.57.26) by edgegateway.intel.com (134.134.137.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Tue, 4 Aug 2026 01:17:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HQ9dk28GcxFctuZHmrObKZ+u9YZjBFWl6GeUXewD4tt/v4HIJ4rsZMBDiTzL5xFWax8sDKgyu8QvhxewCis4pRkN2oBVlc/Y7Dr+fJcOuU4ctXjhZWVTR1pPTovHTJ3Vn9qcnkgxuoDJWGqFplmpBz5f8PQ4g8t0vKshLUuoXILTwasl1GwYtKocc4kdjeNcumsc2swIIBToBx3DVucMva4WtHTndEKlB/4I9uyfZBIycwt+m8HuwQa9CTSmTVp13Q7USUPLkkJlSWDHlgZQOn3OHJfIlwW8ju79SIZIyHcQWf/ag+cnwv6OTcvwqCPl0tybQJ5m1vrmWi8w+FV7UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jkEvjD9aK1hGbhBvjs49TzoNq86ED8Ap9sGWqv+LPEo=; b=ZIXcNxvV7+ZWWs41+sTXh6dPy+D8jd5yFJFTczJDIbXZ53u0rS7nRYL5efvjiMchU+31N5K73i0/RYBYPpXroEO3Bzck521LdXuBviQyCMU9u2gYpnenjX4EiF0d+wE5tUfhXCKN8fhQfbabjrJTkLcqz+ZFYQY96pWRuTu2mD4TtpQ6FW9RPgkC8fj8q4SefW5zizUfh1zpFx57Ikgn6GxCJzW6Otxqpq98kS0R1gf3rmF7YMmXFn5csM2rnaj/N9bdvli7Hn9NXsfKKgeKuH7ymP1z+9gPeU/dtZQfueronyc2iKEFhD+NQzd1aqRuNd8xK5WjDCUEr9gBsUEtNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6020.namprd11.prod.outlook.com (2603:10b6:8:61::19) by DS6PR11MB701697.namprd11.prod.outlook.com (2603:10b6:8:4c6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.18; Tue, 4 Aug 2026 08:17:28 +0000 Received: from DM4PR11MB6020.namprd11.prod.outlook.com ([fe80::3058:1480:e4ac:5765]) by DM4PR11MB6020.namprd11.prod.outlook.com ([fe80::3058:1480:e4ac:5765%4]) with mapi id 15.21.0292.015; Tue, 4 Aug 2026 08:17:27 +0000 Message-ID: Date: Tue, 4 Aug 2026 16:17:18 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sched/cache: honor migrate_llc_task semantics in active load balance To: Tim Chen , Lu Wang CC: , , , , , , , , , , , References: <20260803100227.2585560-1-wanglu.priv@gmail.com> Content-Language: en-US From: "Chen, Yu C" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TP0P295CA0042.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:4::10) To PH7PR11MB6005.namprd11.prod.outlook.com (2603:10b6:510:1e0::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6020:EE_|DS6PR11MB701697:EE_ X-MS-Office365-Filtering-Correlation-Id: e5101221-e4c6-45cb-691c-08def200d13f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|376014|1800799024|7416014|366016|56012099006|4143699003|11063799006|3023799007|6133799003|10067099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: QOL8/H0P8XE/ZEWD3ZveFBcP60Bybx922giLy+jZfPeDqPt2Iw/AmagPRu64WaR90mOGP1MgvG9PqxpJXQYqGyJP8HfMeLHDpWKSi1gc+OBDZysiugJY07pSQUFdwr5wZsDcZCcQjiW9xLC3+ZVfbZh0VNwx6lU6on3v41Zwq+MA21AWgCUdSTOnuC+iH25tF1+LXB9rDf7c637GhhTBnWkosE4vN1QjcNH36rxYnXf6Vz4A2jWWETSTYmhlsJV8TJWd1ZWvoj0FD0cBemAbJ+WGBa10gNRd8NGTugwlfUFHm+3PD6QLyeAVnm5ZcrCpBR9jQzpa/IuQnUFdoB5MTVjFo+ndQRaLycbpWDDssSlTQTpDVWUJ6018UjLhvduX5YVdDNvaaq+ZSzSOItqTilyYh7o+bcGBJx1SqTd34Ky4FFPkKUu3Jx1friSyvpgrfjtLdCjDT7Q1LPilSHtCu9EVWdtBEuUcvbK+x3Fc2CSCWILcPqxh+i24kgn5m+NGKrku/PCPs1+foWsDNT3jSdHnP+mDio9t9ROUKwVxJ0M1CYDUkPUgBdP4SbuvilqO4Fri9DG5W800YfuPw/WzywibD2/sjuLGqvHRl9J7vKH4MuLfKM2wWcb1hCaZJLznabX/RoOm6L43VK2BodCfJmGRNpfVrdQjTD5Qxf60AbY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB6020.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(376014)(1800799024)(7416014)(366016)(56012099006)(4143699003)(11063799006)(3023799007)(6133799003)(10067099003)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QVpRYmdKbEw3cldnMGh0bUZUMFVnV3ZZT2NQL0JJL2hXV09ZTzl2c1ZEb3FF?= =?utf-8?B?MHVuVGQ0UkJOMERkWHU5YVBrMVkyNGhROGFtRHljRTRKTjI1YVRYZkNGZ0Iz?= =?utf-8?B?MW1wRmlLUHNmeklJdTVaU0dTSjhmbXVyRUhrUHhrVys0T1pSOTJuTFZ6dTQ2?= =?utf-8?B?YU1aSU1neWc5aE1CeUc2eXZ4R1NPYUdEVldhclU5bnYvc0pla0lsOC8zSU9C?= =?utf-8?B?N0JhcSsvMVVxRUc2cEhSOTJ4V2NDbGhVZXZFelVHczdhRjJMQ3NPb3lsTXc5?= =?utf-8?B?WlhGM0s5TmJyakxyazRLN2pJNnVCZ21zY29iUjVSZVltNTRFblhsSzcrUzhq?= =?utf-8?B?UXZuYTBpK2RTVFZ4OWxITmpYUG5JV2ZJc3Z0alk5b0ladVpXMmxSQlBnVVBz?= =?utf-8?B?Nnh6T05tWGVzRjNkTEwwckU5Ym5OOXZFQ21OaU5vWDVoQ3VjM1FwWVRsU2Vv?= =?utf-8?B?SnZQQlRmdjhGbjFpclNzbU4wM245N3h0RGx2dnl3MkkxWm50RnQvL2VVd041?= =?utf-8?B?cWU1UmNOc3JtaThkSVphdkFmeDVHSGN1N2VTdE9CNTliVzRhbmtTdzBoLzNi?= =?utf-8?B?cU1Fb2hkZng3Wm5KcTlXUnRPandkZkpMRHVaNXNWMjdEc283Y0VISTU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YFSbxd8kEMZ4YY14kkr8Yn9Rix3/AlwxK/PQZKoA79ZbQVwYZAK77fb90J3eEEmE50n4xxxBiScCngzR3lWxTMqqf3KZ2c7lc95xNioTrOu10FvN5e3drDQ7L0fm3Nn42PkomwxlTHjzdHd0RaBxdYNAZSAMPl0BTWjk0Kj/vf34wfYUM1i5jFF7/kcMT1EDxPYr6P5zY/XAm2nB7oVwYfsNWUB+kp3+/GlXXTzwE11VLSbDtR6A== X-MS-Exchange-CrossTenant-Network-Message-Id: e5101221-e4c6-45cb-691c-08def200d13f X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6005.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2026 08:17:26.9269 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4InFm6Y5Y7gWRfYmjOKywkpXcf89hgtKoeOoM3FqHZwgB5n5Jr75J6jjJP2ECFIm5LjjOARPc4O6QoeqkP2Pxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS6PR11MB701697 X-OriginatorOrg: intel.com On 8/4/2026 8:10 AM, Tim Chen wrote: > On Mon, 2026-08-03 at 18:02 +0800, Lu Wang wrote: >> Thanks for the review, Chenyu. >> >> I got interested in CAS because it strikes a good balance between >> generic CFS load balancing and strict LLC/CPU affinity. >> >> 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 == 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() — with multiple tasks on src_rq, that's not >> necessarily the one whose preferred_llc matches the destination. >> >> 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. >> >> Regarding: >>> this helps the case where the task is the only running one on the >>> src_cpu >> >> 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: >> >> (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 regular > 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(). > There is a comment section above can_migrate_llc() to > explain the policy details. > Yes. Besides, if I understand correctly, I suppose Lu Wang was referring to the following scenario: src_rq has 2 runnable tasks, p1 and p2. p1 prefers dst_rq (dst_llc), while p2 prefers src_rq (src_llc). In this case, migrate_llc_task is set because src_rq has at least one task, p1, that wants to migrate to dst_rq. In ALB, can_migrate_task() found p2 and returns true for p2 thus moves p2 out of its preferred LLC. Here is the reason that it might not happen IMO: Firstly, before ALB is triggered, the generic (passive) load balance is triggered. It iterates over p1 and p2 on src_rq to see if it can move any one of them to dst_rq, and in most cases it succeeds in moving p1 to dst_cpu. As a result, ALB will not be triggered. So the scenario Lu Wang was worried about will not happen. On the other hand, even if there is only p2 running on src_cpu and it prefers src_cpu (src_llc), the passive load balance will fail, and ALB will be triggered. However, alb_break_llc() will return true because p2 wants to stay and it is the only running task, so ALB will not be triggered neither. So the scenario Lu Wang worried about will not happen. thanks, Chenyu