Commit 4e1c1975 authored by Andi Kleen's avatar Andi Kleen

Clean up __page_set_anon_rmap

Linus asked for a cleanup of __page_set_anon_rmap to make
it look more like the cleaner huge pages version.

Factor out the duplicated PageAnon check into a single check
at the beginning of the function.

Remove obsolete comments and rewrite them into standard English.

No functional changes.
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
parent 6a90181c
...@@ -780,10 +780,10 @@ void page_move_anon_rmap(struct page *page, ...@@ -780,10 +780,10 @@ void page_move_anon_rmap(struct page *page,
} }
/** /**
* __page_set_anon_rmap - setup new anonymous rmap * __page_set_anon_rmap - set up new anonymous rmap
* @page: the page to add the mapping to * @page: Page to add to rmap
* @vma: the vm area in which the mapping is added * @vma: VM area to add page to.
* @address: the user virtual address mapped * @address: User virtual address of the mapping
* @exclusive: the page is exclusively owned by the current process * @exclusive: the page is exclusively owned by the current process
*/ */
static void __page_set_anon_rmap(struct page *page, static void __page_set_anon_rmap(struct page *page,
...@@ -793,25 +793,16 @@ static void __page_set_anon_rmap(struct page *page, ...@@ -793,25 +793,16 @@ static void __page_set_anon_rmap(struct page *page,
BUG_ON(!anon_vma); BUG_ON(!anon_vma);
if (PageAnon(page))
return;
/* /*
* If the page isn't exclusively mapped into this vma, * If the page isn't exclusively mapped into this vma,
* we must use the _oldest_ possible anon_vma for the * we must use the _oldest_ possible anon_vma for the
* page mapping! * page mapping!
*/ */
if (!exclusive) { if (!exclusive)
if (PageAnon(page))
return;
anon_vma = anon_vma->root; anon_vma = anon_vma->root;
} else {
/*
* In this case, swapped-out-but-not-discarded swap-cache
* is remapped. So, no need to update page->mapping here.
* We convice anon_vma poitned by page->mapping is not obsolete
* because vma->anon_vma is necessary to be a family of it.
*/
if (PageAnon(page))
return;
}
anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
page->mapping = (struct address_space *) anon_vma; page->mapping = (struct address_space *) anon_vma;
......
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