提交 549381e1 编写于 作者: J Johannes Weiner 提交者: Linus Torvalds

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: NJohannes Weiner <hannes@cmpxchg.org>
Acked-by: NTejun Heo <tj@kernel.org>
Acked-by: NDavid S. Miller <davem@davemloft.net>
Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6dccdcbe
...@@ -204,7 +204,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) ...@@ -204,7 +204,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
unsigned long off = 0; unsigned long off = 0;
vec >>= start & (BITS_PER_LONG - 1); vec >>= start & (BITS_PER_LONG - 1);
while (vec && off < BITS_PER_LONG) { while (vec) {
if (vec & 1) { if (vec & 1) {
page = pfn_to_page(start + off); page = pfn_to_page(start + off);
__free_pages_bootmem(page, 0); __free_pages_bootmem(page, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册