Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

um: Replace UML_ROUND_UP() with PAGE_ALIGN()

Although UML_ROUND_UP() is defined in a shared header file, it
depends on the PAGE_SIZE and PAGE_MASK macros, so it can only be
used in kernel code. Considering its name is not very clear and
its functionality is the same as PAGE_ALIGN(), replace its usages
with a direct call to PAGE_ALIGN() and remove it.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20251027054519.1996090-4-tiwei.bie@linux.dev
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Tiwei Bie and committed by
Johannes Berg
9c84022c de203267

+3 -7
-3
arch/um/include/shared/kern_util.h
··· 15 15 16 16 extern int kmalloc_ok; 17 17 18 - #define UML_ROUND_UP(addr) \ 19 - ((((unsigned long) addr) + PAGE_SIZE - 1) & PAGE_MASK) 20 - 21 18 extern unsigned long alloc_stack(int order, int atomic); 22 19 extern void free_stack(unsigned long stack, int order); 23 20
+1 -1
arch/um/kernel/mem.c
··· 71 71 /* Map in the area just after the brk now that kmalloc is about 72 72 * to be turned on. 73 73 */ 74 - brk_end = (unsigned long) UML_ROUND_UP(sbrk(0)); 74 + brk_end = PAGE_ALIGN((unsigned long) sbrk(0)); 75 75 map_memory(brk_end, __pa(brk_end), uml_reserved - brk_end, 1, 1, 0); 76 76 memblock_free((void *)brk_end, uml_reserved - brk_end); 77 77 uml_reserved = brk_end;
+2 -3
arch/um/kernel/um_arch.c
··· 348 348 * so they actually get what they asked for. This should 349 349 * add zero for non-exec shield users 350 350 */ 351 - 352 - diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); 351 + diff = PAGE_ALIGN(brk_start) - PAGE_ALIGN((unsigned long) &_end); 353 352 if (diff > 1024 * 1024) { 354 353 os_info("Adding %ld bytes to physical memory to account for " 355 354 "exec-shield gap\n", diff); 356 - physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end); 355 + physmem_size += diff; 357 356 } 358 357 359 358 uml_physmem = (unsigned long) __binary_start & PAGE_MASK;