]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/mce/threshold: Remove the redundant this_cpu_dec_return()
authorQiuxu Zhuo <qiuxu.zhuo@intel.com>
Thu, 12 Dec 2024 14:00:58 +0000 (22:00 +0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 30 Dec 2024 18:45:03 +0000 (19:45 +0100)
The 'storm' variable points to this_cpu_ptr(&storm_desc). Access the
'stormy_bank_count' field through the 'storm' to avoid calling
this_cpu_*() on the same per-CPU variable twice.

This minor optimization reduces the text size by 16 bytes.

  $ size threshold.o.*
     text    data     bss     dec     hex filename
     1395    1664       0    3059     bf3 threshold.o.old
     1379    1664       0    3043     be3 threshold.o.new

No functional changes intended.

Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Link: https://lore.kernel.org/r/20241212140103.66964-3-qiuxu.zhuo@intel.com
arch/x86/kernel/cpu/mce/threshold.c

index 89e31e1e5c9c1ef71258f2815027fcc03041bdc2..f4a007616468ecf83d693df815bc62b5458e8b01 100644 (file)
@@ -90,7 +90,7 @@ void cmci_storm_end(unsigned int bank)
        storm->banks[bank].in_storm_mode = false;
 
        /* If no banks left in storm mode, stop polling. */
-       if (!this_cpu_dec_return(storm_desc.stormy_bank_count))
+       if (!--storm->stormy_bank_count)
                mce_timer_kick(false);
 }