• Ingo Molnar's avatar
    sched/balancing: Switch the 'DEFINE_SPINLOCK(balancing)' spinlock into an... · 214c1b7f
    Ingo Molnar authored
    sched/balancing: Switch the 'DEFINE_SPINLOCK(balancing)' spinlock into an 'atomic_t sched_balance_running' flag
    
    The 'balancing' spinlock added in:
    
      08c183f3 ("[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: default avatarIngo Molnar <mingo@kernel.org>
    Reviewed-by: default avatarValentin Schneider <vschneid@redhat.com>
    Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240308105901.1096078-2-mingo@kernel.org
    214c1b7f
fair.c 353 KB