Skip to content

Commit

Permalink
mm/page_alloc.c: remove duplicate check
Browse files Browse the repository at this point in the history
While allocating pages using buddy allocator, the compound page is
probably split up to free pages.  Under these circumstances, the compound
page should be destroyed by destroy_compound_page().  However, there is a
duplicate check to judge if the page is compound.

Remove the duplicate check since the compound_order() returns 0 when the
page doesn't have PG_head set in destroy_compound_page().  That is to say,
destroy_compound_page() needn't check PageHead().

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Gavin Shan authored and Linus Torvalds committed Dec 18, 2012
1 parent 3012d60 commit 0bb2c76
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ static int destroy_compound_page(struct page *page, unsigned long order)
int nr_pages = 1 << order;
int bad = 0;

if (unlikely(compound_order(page) != order) ||
unlikely(!PageHead(page))) {
if (unlikely(compound_order(page) != order)) {
bad_page(page);
bad++;
}
Expand Down

0 comments on commit 0bb2c76

Please sign in to comment.