Commit cf6fe945 authored by Wang Sheng-Hui's avatar Wang Sheng-Hui Committed by Linus Torvalds

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: default avatarWang Sheng-Hui <shhuiw@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fa0f281c
...@@ -489,8 +489,10 @@ __find_buddy_index(unsigned long page_idx, unsigned int order) ...@@ -489,8 +489,10 @@ __find_buddy_index(unsigned long page_idx, unsigned int order)
* (c) a page and its buddy have the same order && * (c) a page and its buddy have the same order &&
* (d) a page and its buddy are in the same zone. * (d) a page and its buddy are in the same zone.
* *
* For recording whether a page is in the buddy system, we set ->_mapcount -2. * For recording whether a page is in the buddy system, we set ->_mapcount
* Setting, clearing, and testing _mapcount -2 is serialized by zone->lock. * PAGE_BUDDY_MAPCOUNT_VALUE.
* Setting, clearing, and testing _mapcount PAGE_BUDDY_MAPCOUNT_VALUE is
* serialized by zone->lock.
* *
* For recording page's order, we use page_private(page). * For recording page's order, we use page_private(page).
*/ */
...@@ -528,8 +530,9 @@ static inline int page_is_buddy(struct page *page, struct page *buddy, ...@@ -528,8 +530,9 @@ static inline int page_is_buddy(struct page *page, struct page *buddy,
* as necessary, plus some accounting needed to play nicely with other * as necessary, plus some accounting needed to play nicely with other
* parts of the VM system. * parts of the VM system.
* At each level, we keep a list of pages, which are heads of continuous * At each level, we keep a list of pages, which are heads of continuous
* free pages of length of (1 << order) and marked with _mapcount -2. Page's * free pages of length of (1 << order) and marked with _mapcount
* order is recorded in page_private(page) field. * PAGE_BUDDY_MAPCOUNT_VALUE. Page's order is recorded in page_private(page)
* field.
* So when we are allocating or freeing one, we can derive the state of the * So when we are allocating or freeing one, we can derive the state of the
* other. That is, if we allocate a small block, and both were * other. That is, if we allocate a small block, and both were
* free, the remainder of the region must be split into blocks. * free, the remainder of the region must be split into blocks.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment