sched/balancing: Switch the 'DEFINE_SPINLOCK(balancing)' spinlock into an 'atomic_t...
authorIngo Molnar <mingo@kernel.org>
Fri, 8 Mar 2024 10:58:52 +0000 (11:58 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 12 Mar 2024 10:03:39 +0000 (11:03 +0100)
commit214c1b7f13954559cf09d5d04b934bf32ba4d618
tree8846628aab4dcae1cb8a9517b5d4f82baa3e4449
parent855684c7d938c2442f07eabc154e7532b4c1fbf9
sched/balancing: Switch the 'DEFINE_SPINLOCK(balancing)' spinlock into an 'atomic_t sched_balance_running' flag

The 'balancing' spinlock added in:

  08c183f31bdb ("[PATCH] sched: add option to serialize load balancing")

... is taken when the SD_SERIALIZE flag is set in a domain, but in reality it
is a glorified global atomic flag serializing the load-balancing of
those domains.

It doesn't have any explicit locking semantics per se: we just
spin_trylock() it.

Turn it into a ... global atomic flag. This makes it more
clear what is going on here, and reduces overhead and code
size a bit:

  # kernel/sched/fair.o: [x86-64 defconfig]

     text    data     bss     dec     hex filename
    60730    2721     104   63555    f843 fair.o.before
    60718    2721     104   63543    f837 fair.o.after

Also document the flag a bit.

No change in functionality intended.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://lore.kernel.org/r/20240308105901.1096078-2-mingo@kernel.org
kernel/sched/fair.c