From: Johannes Weiner Date: Tue, 29 May 2012 22:06:32 +0000 (-0700) Subject: mm: bootmem: remove redundant offset check when finally freeing bootmem X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=549381e19cc7874bb15f0e4760c1004d4fe28d8a;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git mm: bootmem: remove redundant offset check when finally freeing bootmem When bootmem releases an unaligned BITS_PER_LONG pages chunk of memory to the page allocator, it checks the bitmap if there are still unreserved pages in the chunk (set bits), but also if the offset in the chunk indicates BITS_PER_LONG loop iterations already. But since the consulted bitmap is only a one-word-excerpt of the full per-node bitmap, there can not be more than BITS_PER_LONG bits set in it. The additional offset check is unnecessary. Signed-off-by: Johannes Weiner Acked-by: Tejun Heo Acked-by: David S. Miller Cc: Yinghai Lu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/bootmem.c b/mm/bootmem.c index 67872fca97d..053ac3f1cfe 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -204,7 +204,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) unsigned long off = 0; vec >>= start & (BITS_PER_LONG - 1); - while (vec && off < BITS_PER_LONG) { + while (vec) { if (vec & 1) { page = pfn_to_page(start + off); __free_pages_bootmem(page, 0);