mm, vmalloc: Use clamp to simplify code
Subsystems (2)
PATCH 1/1 mm, vmalloc: Use clamp to simplify code
From: Zhang Yanfei <[email protected]>
Signed-off-by Zhang Yanfei <[email protected]>
--- mm/vmalloc.c | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-)
mm/vmalloc.c +2 -10
@@ -1337,16 +1337,8 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,struct vm_struct *area;BUG_ON (in_interrupt ()); -if (flags &VM_IOREMAP ) { -int bit =fls (size); - -if (bit >IOREMAP_MAX_ORDER ) - bit =IOREMAP_MAX_ORDER ; -else if (bit <PAGE_SHIFT ) - bit =PAGE_SHIFT ; - - align =1ul << bit; - } +if (flags &VM_IOREMAP ) + align =1ul <<clamp (fls (size),PAGE_SHIFT ,IOREMAP_MAX_ORDER ); size =PAGE_ALIGN (size);if (unlikely (!size))
Signature · 7 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>