* [PATCH -next] cgroup/cpuset: reduce redundant comparisons for generating shecd domains
@ 2024-07-26 8:59 Chen Ridong
2024-07-26 11:37 ` Michal Koutný
0 siblings, 1 reply; 3+ messages in thread
From: Chen Ridong @ 2024-07-26 8:59 UTC (permalink / raw)
To: tj, lizefan.x, hannes, longman, adityakali, sergeh
Cc: bpf, cgroups, linux-kernel
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@huawei.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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH -next] cgroup/cpuset: reduce redundant comparisons for generating shecd domains
2024-07-26 8:59 [PATCH -next] cgroup/cpuset: reduce redundant comparisons for generating shecd domains Chen Ridong
@ 2024-07-26 11:37 ` Michal Koutný
2024-07-27 7:26 ` chenridong
0 siblings, 1 reply; 3+ messages in thread
From: Michal Koutný @ 2024-07-26 11:37 UTC (permalink / raw)
To: Chen Ridong
Cc: tj, lizefan.x, hannes, longman, adityakali, sergeh, bpf, cgroups,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
Hello.
On Fri, Jul 26, 2024 at 08:59:46AM GMT, Chen Ridong <chenridong@huawei.com> wrote:
> 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.
Please see
https://lore.kernel.org/r/20240704062444.262211-1-xavier_qy@163.com
Your patch is likely obsoleted with that.
Michal
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] cgroup/cpuset: reduce redundant comparisons for generating shecd domains
2024-07-26 11:37 ` Michal Koutný
@ 2024-07-27 7:26 ` chenridong
0 siblings, 0 replies; 3+ messages in thread
From: chenridong @ 2024-07-27 7:26 UTC (permalink / raw)
To: Michal Koutný
Cc: tj, lizefan.x, hannes, longman, adityakali, sergeh, bpf, cgroups,
linux-kernel
On 2024/7/26 19:37, Michal Koutný wrote:
> Hello.
>
> On Fri, Jul 26, 2024 at 08:59:46AM GMT, Chen Ridong <chenridong@huawei.com> wrote:
>> 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.
>
> Please see
> https://lore.kernel.org/r/20240704062444.262211-1-xavier_qy@163.com
>
> Your patch is likely obsoleted with that.
>
> Michal
Thanks, Michal, I'm sorry I didn't notice these patches. It's a good
idea to optimize with uf_node.
Thanks
Ridong
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-27 7:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-26 8:59 [PATCH -next] cgroup/cpuset: reduce redundant comparisons for generating shecd domains Chen Ridong
2024-07-26 11:37 ` Michal Koutný
2024-07-27 7:26 ` chenridong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®