提交 84d1c054 编写于 作者: N Nick Piggin 提交者: Linus Torvalds

[PATCH] i386: pageattr remove __put_page

Stop using __put_page and page_count in i386 pageattr.c
Signed-off-by: NNick Piggin <npiggin@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 f9aed0e2
...@@ -51,6 +51,13 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot, ...@@ -51,6 +51,13 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot,
if (!base) if (!base)
return NULL; return NULL;
/*
* page_private is used to track the number of entries in
* the page table page that have non standard attributes.
*/
SetPagePrivate(base);
page_private(base) = 0;
address = __pa(address); address = __pa(address);
addr = address & LARGE_PAGE_MASK; addr = address & LARGE_PAGE_MASK;
pbase = (pte_t *)page_address(base); pbase = (pte_t *)page_address(base);
...@@ -143,11 +150,12 @@ __change_page_attr(struct page *page, pgprot_t prot) ...@@ -143,11 +150,12 @@ __change_page_attr(struct page *page, pgprot_t prot)
return -ENOMEM; return -ENOMEM;
set_pmd_pte(kpte,address,mk_pte(split, ref_prot)); set_pmd_pte(kpte,address,mk_pte(split, ref_prot));
kpte_page = split; kpte_page = split;
} }
get_page(kpte_page); page_private(kpte_page)++;
} else if ((pte_val(*kpte) & _PAGE_PSE) == 0) { } else if ((pte_val(*kpte) & _PAGE_PSE) == 0) {
set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL)); set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
__put_page(kpte_page); BUG_ON(page_private(kpte_page) == 0);
page_private(kpte_page)--;
} else } else
BUG(); BUG();
...@@ -157,10 +165,8 @@ __change_page_attr(struct page *page, pgprot_t prot) ...@@ -157,10 +165,8 @@ __change_page_attr(struct page *page, pgprot_t prot)
* replace it with a largepage. * replace it with a largepage.
*/ */
if (!PageReserved(kpte_page)) { if (!PageReserved(kpte_page)) {
/* memleak and potential failed 2M page regeneration */ if (cpu_has_pse && (page_private(kpte_page) == 0)) {
BUG_ON(!page_count(kpte_page)); ClearPagePrivate(kpte_page);
if (cpu_has_pse && (page_count(kpte_page) == 1)) {
list_add(&kpte_page->lru, &df_list); list_add(&kpte_page->lru, &df_list);
revert_page(kpte_page, address); revert_page(kpte_page, address);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册