From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 DFC4D3F327B for ; Mon, 27 Jul 2026 09:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.16 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785145604; cv=fail; b=kdrMX3JqepadpWQpOIn7WYciWXg6K6j/qx9J7TfBZchyD97jk0lK9Oywf5eX2rB6blyr20LCk1nD+0gKE01I0dnVqli0wM2YeNKMyAr/7IyIM/aAe8vAUoa0nppkuEr03Wp4dt4gW/oKoEzlQJAOwLd6jkXyfDo0O3kzvqTL994= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785145604; c=relaxed/simple; bh=avWUof8QLVAhQqsPqw2R9F9ep4Vptl6ZNjJiatBGNtM=; h=Message-ID:Date:Subject:To:CC:References:From:In-Reply-To: Content-Type:MIME-Version; b=LI2hkK3dtOnKNupy2aUAti0R3ecZ97lp6W+OyQqZDTUoO6hJ0MT6OjRJGpbbPVupxxoQktzivbH/Y2MA+HxQ53FYKiPjBx5exUQm7/9XFVtt9gM2j+l9w9EqOwUR5XIZaEWBaH2ULRGG5O1X7/nbZwmEUIbt6n7gXjFSIeft9sU= 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=fdTu8Ay4; arc=fail smtp.client-ip=198.175.65.16 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="fdTu8Ay4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785145602; x=1816681602; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=avWUof8QLVAhQqsPqw2R9F9ep4Vptl6ZNjJiatBGNtM=; b=fdTu8Ay4LU5UV50GBh5ICp56087CY5MIyClATlmksikpZjZsXKZrattq 7FGSg5PIZWoDUZ+LfGJZFLcT9eEk1cjUV2UKWHlyIx7Ms5JUEeQoKC86A g3w9iyajmZXrFy4u53SHrMyzongZpR1wmWgBUoc57ntQ6dKoZjGQ08buQ I7VNvaW/wzomKYc4UcNzjqEyGPiOkvaI9kiaeL8tE5iXSukdWRRRkfBS4 ip/+Uz0c5BByjMQ7NqOsyXWGrxVTbXdk8ackle4oiQEZ4kDWtsQTwW8rY Cic6rXjJT7hLPlZVz+05BRWROnvwQdwkTvoAvTh7PduTMZei9JWCzIV0x w==; X-CSE-ConnectionGUID: 8wmhDuVJTdK4nLKPxZIbWg== X-CSE-MsgGUID: MqF7TN06QF2Pz+9wWaL4QQ== X-IronPort-AV: E=McAfee;i="6800,10657,11857"; a="85901157" X-IronPort-AV: E=Sophos;i="6.25,188,1779174000"; d="scan'208";a="85901157" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2026 02:46:41 -0700 X-CSE-ConnectionGUID: hohlb/sTR7ecHz3j8hm/8Q== X-CSE-MsgGUID: 2fGat5KGRQO8agaZc/6KVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,188,1779174000"; d="scan'208";a="263667457" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by orviesa005.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2026 02:46:41 -0700 Received: from FMSMSX901.amr.corp.intel.com (10.18.126.90) by fmsmsx903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Mon, 27 Jul 2026 02:46:40 -0700 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) by FMSMSX901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43 via Frontend Transport; Mon, 27 Jul 2026 02:46:40 -0700 Received: from BL2PR02CU003.outbound.protection.outlook.com (52.101.52.15) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.43; Mon, 27 Jul 2026 02:46:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eIt0y/oPiqcAQv4UJmnQZFlhMKM7C+pO+wchXlon2lw8N4wSBnuDOnYcnpTSIWTIwfwIOiY+zh26gZi9cHloyXRGlxHmCwZZBwOjcElXo7CBTxQx6FDqlfGS4+ggubzVmhqhw+qNsbQZgK757fgNcevQphFtKpaLD0G4juVdRVD0zI4EFph/f3Y1Dlugyvou26o77sNrvESDWPpDNwjPyRSyUvSEvueicyS+wcobMzNjkD4YiDy8s6pKWgyNp0ZoxuN6vNTY0xJo8IJ8gxyQTbPsKWQHs1exfpUTy+HTWz1Dt8BsO8XqR19l32I7uGg5o9QZxwoU9Ur3000JEx021Q== 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=BsWMH4JvJ7Bn2oDywpxxkI8ZeuLOx9A8UcwRllZkeek=; b=V+w1rPqrPGYITlQBXM3dpVjAjdzHBscobtOuBhUZYSXYtJmWtXrBvU7QvG4A4yNwMpAn/lE3++VKJEvrPvlyCGXxAqT/pReYz6Dl5IG23R6RvFK3zDSM14ilNocEjiEbVIGQGAm5FSduFlZkr8LG6JSC91QhwvRvsww6WrfgMTT9TQaociF3UwxXdnn2wfrVqSk5awwD2tS76V8LZMWX85T/3/JmmymLZ4dlcePGEsKSmN38F1lkoE2oQP1QM/hREss5B3jSHhs4+P18UNk6bB6/xIZ/BaHQu3YLHfzzsxThhHOF91n8GOd9bJA8A+v+DsEdLxER2SqLVRVNc4TVFg== 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 SJ0PR11MB6717.namprd11.prod.outlook.com (2603:10b6:a03:44f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.13; Mon, 27 Jul 2026 09:46:36 +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.0245.012; Mon, 27 Jul 2026 09:46:36 +0000 Message-ID: <70eb8310-bc01-4598-99e5-c53bf101a36d@intel.com> Date: Mon, 27 Jul 2026 17:46:26 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sched/cache: Fix a thread aggregation conflict when there is one runnable task To: Zhan Xusheng CC: K Prateek Nayak , Ingo Molnar , Juri Lelli , Tim Chen , Valentin Schneider , Mel Gorman , Steven Rostedt , Dietmar Eggemann , Ben Segall , Yi Lai , , Zhan Xusheng , Peter Zijlstra , "Vincent Guittot" , "chen.yu@linux.dev" References: <20260727012914.229171-1-yu.c.chen@intel.com> <20260727064111.1350672-1-zhanxusheng1024@gmail.com> Content-Language: en-US From: "Chen, Yu C" In-Reply-To: <20260727064111.1350672-1-zhanxusheng1024@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: TP0P295CA0049.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:3::20) To DM4PR11MB6020.namprd11.prod.outlook.com (2603:10b6:8:61::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_|SJ0PR11MB6717:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e6b96ae-d731-4810-b8bb-08deebc3f2d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|376014|1800799024|366016|7416014|56012099006|4143699003|11063799006|10067099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: S0ZcWs7AdQT9Bd2hw6945WEW87B9nYA4SSN0IF/8MPN9qGDzqD937asrmTmyfDtU6E1afmndu23B2LUed9reN1hARRucpyrada+6m8+j2LVSq3TIjxTbf/PSzyxIfwEQryWzolj0cnlr3GlAIqO+/JlLqtRbFSkn1l9lku679ltdtXxG0ToCOZa23HzXb7qCaqt8njR5HPSHlcdF5mCblu1lskaQbbyLCMvzHFcXuWNfuTObYiLstZl3yeG11iyUd/5CnMA8etY5/FA4LbWX0B1W8Xp/Yejqh0FdAHLUo0ebW09TsKuXsW32gIAs9WKcDTDJK4lKcJ1zCg2URXIP2YL2gWH+pTLAo6zYNjhg0H+0dSEh/ueuEEN070Uhjkr07AFQPOZwOMadvOqqLOFUfKZPGCIfUjVZ4AHv8FwrZ1A5b+dGZ+xxemP2kRVWsCt42rEGbXICFPrDRBejXyHyXgnZilN9FdWglSI4jOySEdfFoO1urotYzRYrR6y7omWyCpAyNOkeA/kMeKtcxDSKBUbjTsis0J8qgDuQhgnpbmnZW1UZBLpb+kSVp/HcH2IiuayunKETQpYROaD+KNNkHsCdYCTM9g82yMz59BgWiIyY9UYRJrwHJwPaGkiY2Xf+AQenCykK94gEGh6ySh1nEKaMxOHDg0yVARt8ENKxVJ4= 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)(366016)(7416014)(56012099006)(4143699003)(11063799006)(10067099003)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ajNqZTYzdUxSWjZaRHlrRTdGUktlVlQ0aXJSUmM5ZXNzckc5WDk0WDV0M2tV?= =?utf-8?B?a1hiUDZGVkpySmFUcExtZ1ZnVm9lWm1LTHM4WnZtQzdrNnRuYlJoUWVOaFRQ?= =?utf-8?B?THBGOUdkaEdpajEvZ0pOQ056WEFFL0dhY2U5TUd0WVU1Z3NHQkFjb2laRGpa?= =?utf-8?B?cHN5bXhmaVJlRTBUNUkwYkNTdmpJNDNvS3lhTHNDN0hIZU8yWGxlZHdEaDFY?= =?utf-8?B?TlFvcGlMUFhhWW5sQ25tNlpmUFVuWDVWcDBLWWNtZE1nemhsTDBQQ0ZjQmRp?= =?utf-8?B?ODhWajFEWCszU3MwNVJMMXlOOG1tbTdqWkFuUnRqZnpXS2dDa3BhSUZqV1RH?= =?utf-8?B?RTlGMzltd0p6eVc0UFM2eC9hL3dHSnIrbWc5SlZZNm5XRzNYQ01SdUM2SGto?= =?utf-8?B?dDdWLzM4M21yYnJWZ2Jyczd1b1U3OEk2MTdMY0RnTThJeWxFbThUbWgwS3Nq?= =?utf-8?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XJ2Q21IVHpCdkpxRkRkYTds?= =?utf-8?B?YnJHVXZMd0pUbXFPNnFSb05ZbS90dEN2OWl3ZGc3QXBMY09HN04rUT09?= X-Exchange-RoutingPolicyChecked: K/BIKXK6c2aYldXNSoJ+zkHdNjB1qmVc+ePaHSuFLyJcB9MqMRi8LouYVqayu/A2kf7yOKZXR44LG7K79nmtkLlueYr3nFe2fehCOMeY3+Uo4Ts3wFjohqSHpA7X0b9FPmIkGwmQLzLexZMZm4/K73kCIYMFqOyW2YeOTKq/YLh11qD5nhZlUL5mTxjY4KIl8hJlTrusQH8wIq9QsCc2RRZyCWT2AlqqSUsVp/TGWYIn0xjOUoBGGq4cHyelFrMiE6m++LZoH+B/exEhUypPmW2OeFa+YQzCq1UmyMiOYXt/2gwbS9d4dARzb5AOy0VRavPOGh7Cb7JRm2WQMzaqug== X-MS-Exchange-CrossTenant-Network-Message-Id: 0e6b96ae-d731-4810-b8bb-08deebc3f2d9 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6020.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2026 09:46:36.1532 (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: Vpu/T/ZR2vRC4ZszsMtDeeQhMAkjXsBjzTYzbntr/rN+Jizc5pgtEoB0lYbYExlKUwEccCutRGKAjVyo8Z3TEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB6717 X-OriginatorOrg: intel.com Hi Xusheng, On 7/27/2026 2:41 PM, Zhan Xusheng wrote: > On Mon, Jul 27, 2026 at 09:29:14AM +0800, Chen Yu wrote: >> - if (sched_asym(env->sd, i, env->dst_cpu) && nr_running == 1) >> + if (sched_asym(env->sd, i, env->dst_cpu) && nr_running == 1 && >> + env->migration_type != migrate_llc_task) >> continue; > > The fix looks correct for the ITMT case. I also convinced myself it does > not introduce a migrate_llc_task <-> asym-packing ping-pong: once the task > lands in its preferred LLC, a subsequent asym pull-back is a migrate_task, > which goes through can_migrate_task() -> migrate_degrades_llc() -> > can_migrate_llc_task() == mig_forbid (moving away from the preferred LLC), > so it returns 0 and the task is not pulled back (modulo the > nr_balance_failed >= cache_nice_tries + 1 escape). So it should not > oscillate. Nice. > Thanks for checking the ping-pong angle, and I agree it does not oscillate. I did a further investigation, and another reason it holds: with only one running task, migrate_degrades_llc() is not what keeps the task in its preferred LLC. In the regular load balance path can_migrate_task() already bails at task_on_cpu() - since that task is curr. And in the active balance path alb_break_llc() blocks it first: if (env->src_rq->nr_running <= 1) return true; so the task is not pulled back either way. > One minor consistency question: the adjacent single-task filter just above, > > if (env->sd->flags & SD_ASYM_CPUCAPACITY && > !capacity_greater(capacity_of(env->dst_cpu), capacity) && > nr_running == 1) > continue; > > has the same nr_running == 1 shape and is not exempted for > migrate_llc_task. I don't think it is reachable on current hardware (it > would need both multiple LLCs, so migrate_llc_task can fire, and > asymmetric CPU capacity at that domain), so this is not a correctness > concern for the reported case. But since the two filters now treat > migrate_llc_task differently, was leaving the capacity one intentional > (capacity prioritized over cache locality on asym-capacity), or just out > of scope here? A word in the changelog would make the intent clear. > Good point. OK, let me add description in changelog: The adjacent SD_ASYM_CPUCAPACITY filter was left unchanged. In theory it should have been handled in the same way, but it is not clear yet whether any platform has both multiple LLCs and asymmetric CPU capacity, so the asymmetric CPU capacity logic was not fine-tuned here and can be revisited once such a platform shows up. In theory the priority follows the order of enum group_type: the priority of group_llc_balance is lower than that of group_overloaded and higher than that of all other group types. thanks, Chenyu