Skip to content

sched/topology: optimize topology_span_sane()

Yury Norov lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 7 repliesIn review
  2. v22 patches 4 repliesSuperseded
  3. v12 patches 5 repliesSuperseded

Changes in v3 from the cover letter

- add topology_cpumask_equal() helper in #3;
- re-use 'cpu' as an iterator int the for_each_cpu() loop;
- add proper versioning for all patches.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3sched/topology: pre-compute topology_span_sane() loop paramskernel/sched/topology.c+7 -40 replies
2/3sched/topology: optimize topology_span_sane()kernel/sched/topology.c+13 -00 replies
3/3sched/topology: reorganize topology_span_sane() checking orderkernel/sched/topology.c+18 -130 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchChen YuValentin Schneider
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] sched/topology: optimize topology_span_sane()

The function may call cpumask_equal with tl->mask(cpu) == tl->mask(i), even when cpu != i. In such case, cpumask_equal() would always return true, and we can proceed to the next iteration immediately.

Valentin Schneider shares on it:

PKG can potentially hit that condition, and so can any sched_domain_mask_f that relies on the node masks...

I'm thinking ideally we should have checks in place to ensure all node_to_cpumask_map[] masks are disjoint, then we could entirely skip the levels that use these masks in topology_span_sane(), but there's unfortunately no nice way to flag them... Also there would be cases where there's no real difference between PKG and NODE other than NODE is still based on a per-cpu cpumask and PKG isn't, so I don't see a nicer way to go about this.

v1: https://lore.kernel.org/lkml/ZrJk00cmVaUIAr4G@yury-ThinkPad/T/
v2: https://lkml.org/lkml/2024/8/7/1299
v3:
- add topology_cpumask_equal() helper in #3;
- re-use 'cpu' as an iterator int the for_each_cpu() loop;
- add proper versioning for all patches.

Yury Norov (3):
sched/topology: pre-compute topology_span_sane() loop params sched/topology: optimize topology_span_sane() sched/topology: reorganize topology_span_sane() checking order

 kernel/sched/topology.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0