diff options
author | Wang Sheng-Hui <shhuiw@gmail.com> | 2013-09-11 17:22:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:58:06 -0400 |
commit | cf6fe945389e674130dc7564392930cf7fb9f5e8 (patch) | |
tree | ee75b30bb6fa6dcf8d4499a760095c221c59b00e /mm/page_alloc.c | |
parent | fa0f281cf9de8e6877e6536f18a3fc77368df64d (diff) |
mm: correct the comment about the value for buddy _mapcount
Set _mapcount PAGE_BUDDY_MAPCOUNT_VALUE to make the page buddy. Not the
magic number -2.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ff2782576e39..0ee638f76ebe 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -489,8 +489,10 @@ __find_buddy_index(unsigned long page_idx, unsigned int order) | |||
489 | * (c) a page and its buddy have the same order && | 489 | * (c) a page and its buddy have the same order && |
490 | * (d) a page and its buddy are in the same zone. | 490 | * (d) a page and its buddy are in the same zone. |
491 | * | 491 | * |
492 | * For recording whether a page is in the buddy system, we set ->_mapcount -2. | 492 | * For recording whether a page is in the buddy system, we set ->_mapcount |
493 | * Setting, clearing, and testing _mapcount -2 is serialized by zone->lock. | 493 | * PAGE_BUDDY_MAPCOUNT_VALUE. |
494 | * Setting, clearing, and testing _mapcount PAGE_BUDDY_MAPCOUNT_VALUE is | ||
495 | * serialized by zone->lock. | ||
494 | * | 496 | * |
495 | * For recording page's order, we use page_private(page). | 497 | * For recording page's order, we use page_private(page). |
496 | */ | 498 | */ |
@@ -528,8 +530,9 @@ static inline int page_is_buddy(struct page *page, struct page *buddy, | |||
528 | * as necessary, plus some accounting needed to play nicely with other | 530 | * as necessary, plus some accounting needed to play nicely with other |
529 | * parts of the VM system. | 531 | * parts of the VM system. |
530 | * At each level, we keep a list of pages, which are heads of continuous | 532 | * At each level, we keep a list of pages, which are heads of continuous |
531 | * free pages of length of (1 << order) and marked with _mapcount -2. Page's | 533 | * free pages of length of (1 << order) and marked with _mapcount |
532 | * order is recorded in page_private(page) field. | 534 | * PAGE_BUDDY_MAPCOUNT_VALUE. Page's order is recorded in page_private(page) |
535 | * field. | ||
533 | * So when we are allocating or freeing one, we can derive the state of the | 536 | * So when we are allocating or freeing one, we can derive the state of the |
534 | * other. That is, if we allocate a small block, and both were | 537 | * other. That is, if we allocate a small block, and both were |
535 | * free, the remainder of the region must be split into blocks. | 538 | * free, the remainder of the region must be split into blocks. |