[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/sched: Fix the sorted insertion in sched_domain_insert_unit()
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
- Date: Tue, 20 Oct 2026 15:35:34 -0700
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- 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=Vzji5eITuo5XfFpeBwgxfWgE41NZan1QMZX+6pDPknM=; b=IWR3o3KGO9KAXzVaes0Eh36OalUxsUjKEJRb4UfchrAYoAlTJ++19B6OnRAm8LuEUlUAg1iBocNFhgke8e5K5VlA5ShRRP8uueYMkHr4xdPE2mKe0Rw9/ygfURXdWQxut9vg4pWwjn8i7YshMqpMRs6tC+mhj60VuDLga0Z145PKL1tjipstG1YuCsWb+pWeiKm67FxjmWptYS9wQn9klgVCJs3f4PUjJLnkQLkkpAN4XlXBH3IyFpBm7z5SkVpDDEJ32E3EjZvl6tMuaXs/7qhC0XdszQyY65bb+QXVVMDxU3IghGFqBYVGuFJYHbcstfy/v/l+dckYF+MgYG3BCg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c42g3tyEN+Y0tQxCOi0ccS0HP+tihUmxpIa1B9F2okmIRcfApZ3mSPcAm2Op2kn0mfG95gpuyiiH27MHyHkrdt/1UY1+ciAAn+GB6322eXAQP4QK3CZcH0bLSV0k86H8D4ab1npJy50eITU7eHr7YOgqsxaMNfcWO6Mrvm4+scPk3nSwFOeo6guqkzwAg9DSu1zJjfLQIS7jyv0MiOolYihwH7u3DQRvfPGiA7rddr1b+SlLHbrsSVLsBgJE+V5r1Y1kGAiMHlMA4iQ1N1TD1k7IdPvMlvpUxO1KO9wx1xx1XHFP//TWRjFv7hmdkctW/pgCMZ4k3X1ACSuUPLgHiw==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Cc: <dfaggioli@xxxxxxxx>, <jgross@xxxxxxxx>, <gwd@xxxxxxxxxxxxxx>, <stefano.stabellini@xxxxxxx>
- Delivery-date: Tue, 20 Oct 2026 22:36:15 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
The loop links the new unit in front of the unit whose successor has a
higher unit_id, rather than after it: inserting 1 into {0, 2} gives
{1, 0, 2}. Stop at the first unit with a higher unit_id instead.
I think it usually works because guest vCPUs are typically inserted in
order.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
---
xen/common/sched/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 0b072bdee6..a95d6752df 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -489,8 +489,7 @@ static void sched_domain_insert_unit(struct sched_unit
*unit, struct domain *d)
for ( prev_unit = &d->sched_unit_list; *prev_unit;
prev_unit = &(*prev_unit)->next_in_list )
- if ( (*prev_unit)->next_in_list &&
- (*prev_unit)->next_in_list->unit_id > unit->unit_id )
+ if ( (*prev_unit)->unit_id > unit->unit_id )
break;
unit->next_in_list = *prev_unit;
--
2.43.0
|