]> git.ipfire.org Git - thirdparty/linux.git/commit
x86/tlb: Simplify choose_new_asid() and generate better code
authorBorislav Petkov (AMD) <bp@alien8.de>
Thu, 3 Apr 2025 08:56:23 +0000 (10:56 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 3 Apr 2025 11:35:37 +0000 (13:35 +0200)
commit2fb34b1566a386913b291d04f91ba6f6e6a5bb99
treedd8f9ebdbfd20c9322417911c410877c93975354
parenta72d55dc3bd6555cc1f97459b42b7f62ae480f13
x86/tlb: Simplify choose_new_asid() and generate better code

Have it return the two things it does return:

 - a new ASID and
 - the need to flush the TLB or not,

in a struct which fits in a single 32-bit register and whack the IO
parameters.

Beyond being easier to read, this also helps the compiler generate
better, more compact code:

  # arch/x86/mm/tlb.o:

  text     data      bss      dec      hex  filename
  9341      753      516    10610     2972  tlb.o.before
  9213      753      516    10482     28f2  tlb.o.after

No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Uros Bizjak <ubizjak@gmail.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250403085623.20824-1-bp@kernel.org
arch/x86/mm/tlb.c