public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] sched/topology: optimize topology_span_sane()
@ 2024-08-02 17:57 Yury Norov
  2024-08-02 17:57 ` [PATCH 1/2] sched/topology: pre-compute topology_span_sane() loop params Yury Norov
  2024-08-02 17:57 ` [PATCH 2/2] sched/topology: optimize topology_span_sane() Yury Norov
  0 siblings, 2 replies; 10+ messages in thread
From: Yury Norov @ 2024-08-02 17:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Yury Norov, Christophe JAILLET, Leonardo Bras, Ingo Molnar,
	Peter Zijlstra, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, Valentin Schneider

Pre-compute pre-compute topology_span_sane() loop params and optimize
the functtion to avoid calling cpumask_equal() when masks are the same.

This series follows up comments from here:

https://lore.kernel.org/lkml/ZqqV5OxZPHUgjhag@LeoBras/T/#md6b2b6bdd09e63740bbf010530211842a79b5f57


Yury Norov (2):
  sched/topology: pre-compute topology_span_sane() loop params
  sched/topology: optimize topology_span_sane()

 kernel/sched/topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH v2 0/2] sched/topology: optimize topology_span_sane()
@ 2024-08-07 19:05 Yury Norov
  2024-08-07 19:05 ` [PATCH 2/2] " Yury Norov
  0 siblings, 1 reply; 10+ messages in thread
From: Yury Norov @ 2024-08-07 19:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Yury Norov, Chen Yu, Christophe JAILLET, Leonardo Bras,
	Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider

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:
 - defer initialization of 'mc' in patch #1 @Chen Yu;
 - more comments from Valentin Schneider.


Yury Norov (2):
  sched/topology: pre-compute topology_span_sane() loop params
  sched/topology: optimize topology_span_sane()

 kernel/sched/topology.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <20240319185148.985729-1-kyle.meyer@hpe.com>]

end of thread, other threads:[~2024-08-07 19:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-02 17:57 [PATCH 0/2] sched/topology: optimize topology_span_sane() Yury Norov
2024-08-02 17:57 ` [PATCH 1/2] sched/topology: pre-compute topology_span_sane() loop params Yury Norov
2024-08-03 15:32   ` Chen Yu
2024-08-02 17:57 ` [PATCH 2/2] sched/topology: optimize topology_span_sane() Yury Norov
2024-08-06 15:50   ` Valentin Schneider
2024-08-06 18:00     ` Yury Norov
2024-08-07 13:53       ` Valentin Schneider
2024-08-07 16:39         ` Yury Norov
  -- strict thread matches above, loose matches on Subject: below --
2024-08-07 19:05 [PATCH v2 0/2] " Yury Norov
2024-08-07 19:05 ` [PATCH 2/2] " Yury Norov
     [not found] <20240319185148.985729-1-kyle.meyer@hpe.com>
     [not found] ` <20240319185148.985729-3-kyle.meyer@hpe.com>
2024-03-20 18:32   ` [PATCH 2/2] sched/topology: Optimize topology_span_sane() Yury Norov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox