[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240726085946.2243526-1-chenridong@huawei.com>
Date: Fri, 26 Jul 2024 08:59:46 +0000
From: Chen Ridong <chenridong@...wei.com>
To: <tj@...nel.org>, <lizefan.x@...edance.com>, <hannes@...xchg.org>,
<longman@...hat.com>, <adityakali@...gle.com>, <sergeh@...nel.org>
CC: <bpf@...r.kernel.org>, <cgroups@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH -next] cgroup/cpuset: reduce redundant comparisons for generating shecd domains
In the generate_sched_domains function, it's unnecessary to start the
second for loop with zero, which leads redundant comparisons.
Simply start with i+1, as that is sufficient.
Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
kernel/cgroup/cpuset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 40ec4abaf440..1c4c36db3d93 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1113,7 +1113,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
struct cpuset *a = csa[i];
int apn = a->pn;
- for (j = 0; j < csn; j++) {
+ for (j = i + 1; j < csn; j++) {
struct cpuset *b = csa[j];
int bpn = b->pn;
--
2.34.1
Powered by blists - more mailing lists