From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 E746A70809; Thu, 4 Jun 2026 02:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780538435; cv=none; b=LydRjuc6sbDIJ+Hze5Zznm+SUXHztf9Xm0RTlzRuFg1ftJuusCYUcCI788VYxWBELOnZBQU7UT5/nihlD8Wroj0d/TQdLysVDi3OCsS2PgLjJ2jkQkjJ72WhMobSHCSruLqdbF1t/a9o8AHtVRQ6y96o8U/RVXrJXqoQdUfo84M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780538435; c=relaxed/simple; bh=TLeklP9tZV4IRMAnM+TAFVdxDegWu02V9abWBNLDgGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ieNJkn7aso4Z0YUbUQUBscFSUBlgwcqUsU1LGy/sNlbi/np2uaMnmzA+Sa64QJzcrWgMFbfO6QlaYhqjs9uj3W4Q+/YY7dvyMj6r40nK2TCFS0Fiws66j17iQlSaabi7ir92ZseSr5y58MgGZIhqkndXBX/wCkJgDM+cUMwl/4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KRKcw2e5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KRKcw2e5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 974F71F00898; Thu, 4 Jun 2026 02:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780538434; bh=u5ZXyxRmN925shYlI/YuTWC0iodGKkq4C19zisanqYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KRKcw2e5sXjz/cfifnlwM+1oFY3LX7vkXcCd48vEDtyKw2lGv6pkn/1Vq7OuYUIVj AybZxMJSehZ6I7jkCfc67lNhtXYPExtuBeLVh3tz+ax+0JNPWta8C88pTPjIEdccn3 Mz3GtaGZdps3NRs9hAIh9Zds59tsJiOwiZkteZyBmYqI+mWiklP8gTi1dQ5Jx17f67 l4jIyFvS6PA9ytquD33clrBxK4L+5WVySzW6Tid9JdJVd9uzELZg4rcc87zQVd4CLp L65JrOg0A/OrkojIR0Jb3lDr9b90cRl5+qaFdVtzOOCUVzw/Dz00SAX7/EMSpsxD3K i56NC720Gg1/Q== From: Tejun Heo To: David Vernet , Andrea Righi , Changwoo Min Cc: Emil Tsalapatis , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org, Tejun Heo Subject: [PATCH 1/4] sched_ext: Order single-cid cmask helpers as (cid, mask) Date: Wed, 3 Jun 2026 16:00:29 -1000 Message-ID: <20260604020032.3536466-2-tj@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260604020032.3536466-1-tj@kernel.org> References: <20260604020032.3536466-1-tj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit __scx_cmask_set(), __scx_cmask_contains() and __scx_cmask_word() take the cmask first and the cid second. The kernel's bit and cpumask predicates put the index first: test_bit(nr, addr), cpumask_test_cpu(cpu, mask). Reorder the cmask helpers to (cid, mask) for consistency, ahead of new single-cid ops added next. Mask-level ops (and/or/andnot/copy/subset/intersects) keep (dst, src). Signed-off-by: Tejun Heo --- kernel/sched/ext_cid.c | 2 +- kernel/sched/ext_cid.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sched/ext_cid.c b/kernel/sched/ext_cid.c index 808c6390da5a..66944a7ef79d 100644 --- a/kernel/sched/ext_cid.c +++ b/kernel/sched/ext_cid.c @@ -267,7 +267,7 @@ void scx_cpumask_to_cmask(const struct cpumask *src, struct scx_cmask *dst) s32 cid = __scx_cpu_to_cid(cpu); if (cid >= 0) - __scx_cmask_set(dst, cid); + __scx_cmask_set(cid, dst); } } diff --git a/kernel/sched/ext_cid.h b/kernel/sched/ext_cid.h index abea22ba2cc2..46fd8eda0443 100644 --- a/kernel/sched/ext_cid.h +++ b/kernel/sched/ext_cid.h @@ -147,13 +147,13 @@ static inline bool scx_is_cid_type(void) return static_branch_unlikely(&__scx_is_cid_type); } -static inline bool __scx_cmask_contains(const struct scx_cmask *m, u32 cid) +static inline bool __scx_cmask_contains(u32 cid, const struct scx_cmask *m) { return likely(cid >= m->base && cid < m->base + m->nr_cids); } /* Word in bits[] covering @cid. @cid must satisfy __scx_cmask_contains(). */ -static inline u64 *__scx_cmask_word(const struct scx_cmask *m, u32 cid) +static inline u64 *__scx_cmask_word(u32 cid, const struct scx_cmask *m) { return (u64 *)&m->bits[cid / 64 - m->base / 64]; } @@ -218,11 +218,11 @@ static inline void scx_cmask_reframe(struct scx_cmask *m, u32 base, u32 nr_cids) m->nr_cids = nr_cids; } -static inline void __scx_cmask_set(struct scx_cmask *m, u32 cid) +static inline void __scx_cmask_set(u32 cid, struct scx_cmask *m) { - if (!__scx_cmask_contains(m, cid)) + if (!__scx_cmask_contains(cid, m)) return; - *__scx_cmask_word(m, cid) |= BIT_U64(cid & 63); + *__scx_cmask_word(cid, m) |= BIT_U64(cid & 63); } #endif /* _KERNEL_SCHED_EXT_CID_H */ -- 2.54.0