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

buddy: clarify comments describing buddy merge

In __free_one_page(), the comment "Move the buddy up one level" appears
attached to the break and by implication when the break is taken we are
moving it up one level:

if (!page_is_buddy(page, buddy, order))
break; /* Move the buddy up one level. */

In reality the inverse is true, we break out when we can no longer merge
this page with its buddy. Looking back into pre-history (into the full
git history) it appears that these two lines accidentally got joined as
part of another change.

Move the comment down where it belongs below the if and clarify its
language.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andy Whitcroft and committed by
Linus Torvalds
3c82d0ce 42b77728

+2 -1
+2 -1
mm/page_alloc.c
··· 432 432 433 433 buddy = __page_find_buddy(page, page_idx, order); 434 434 if (!page_is_buddy(page, buddy, order)) 435 - break; /* Move the buddy up one level. */ 435 + break; 436 436 437 + /* Our buddy is free, merge with it and move up one order. */ 437 438 list_del(&buddy->lru); 438 439 zone->free_area[order].nr_free--; 439 440 rmv_page_order(buddy);