kernel-hacking-2024-linux-s.../arch/x86/mm
Linus Torvalds 4477b39c32 minmax: add a few more MIN_T/MAX_T users
Commit 3a7e02c040 ("minmax: avoid overly complicated constant
expressions in VM code") added the simpler MIN_T/MAX_T macros in order
to avoid some excessive expansion from the rather complicated regular
min/max macros.

The complexity of those macros stems from two issues:

 (a) trying to use them in situations that require a C constant
     expression (in static initializers and for array sizes)

 (b) the type sanity checking

and MIN_T/MAX_T avoids both of these issues.

Now, in the whole (long) discussion about all this, it was pointed out
that the whole type sanity checking is entirely unnecessary for
min_t/max_t which get a fixed type that the comparison is done in.

But that still leaves min_t/max_t unnecessarily complicated due to
worries about the C constant expression case.

However, it turns out that there really aren't very many cases that use
min_t/max_t for this, and we can just force-convert those.

This does exactly that.

Which in turn will then allow for much simpler implementations of
min_t()/max_t().  All the usual "macros in all upper case will evaluate
the arguments multiple times" rules apply.

We should do all the same things for the regular min/max() vs MIN/MAX()
cases, but that has the added complexity of various drivers defining
their own local versions of MIN/MAX, so that needs another level of
fixes first.

Link: https://lore.kernel.org/all/b47fad1d0cf8449886ad148f8c013dae@AcuMS.aculab.com/
Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-07-28 13:41:14 -07:00
..
pat - 875fa64577da ("mm/hugetlb_vmemmap: fix race with speculative PFN 2024-07-21 17:15:46 -07:00
amdtopology.c
cpu_entry_area.c
debug_pagetables.c
dump_pagetables.c
extable.c
fault.c The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
highmem_32.c
hugetlbpage.c treewide: use initializer for struct vm_unmapped_area_info 2024-04-25 20:56:27 -07:00
ident_map.c x86/mm: Introduce kernel_ident_mapping_free() 2024-06-17 17:46:22 +02:00
init.c The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
init_32.c
init_64.c - 875fa64577da ("mm/hugetlb_vmemmap: fix race with speculative PFN 2024-07-21 17:15:46 -07:00
iomap_32.c
ioremap.c
kasan_init_64.c
kaslr.c
kmmio.c
kmsan_shadow.c
maccess.c
Makefile kbuild: use $(src) instead of $(srctree)/$(src) for source directory 2024-05-10 04:34:52 +09:00
mem_encrypt.c x86/sev: Add callback to apply RMP table fixups for kexec 2024-04-29 11:21:09 +02:00
mem_encrypt_amd.c - Add support for running the kernel in a SEV-SNP guest, over a Secure 2024-07-16 11:12:25 -07:00
mem_encrypt_boot.S
mem_encrypt_identity.c
mm_internal.h
mmap.c mm: switch mm->get_unmapped_area() to a flag 2024-04-25 20:56:25 -07:00
mmio-mod.c
numa.c x86/mm/numa: Use NUMA_NO_NODE when calling memblock_set_node() 2024-06-06 22:20:39 +03:00
numa_32.c
numa_64.c
numa_emulation.c
numa_internal.h
pf_in.c
pf_in.h
pgprot.c
pgtable.c minmax: add a few more MIN_T/MAX_T users 2024-07-28 13:41:14 -07:00
pgtable_32.c
physaddr.c
physaddr.h
pkeys.c
pti.c
srat.c
testmmiotrace.c
tlb.c