public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Nick Piggin <npiggin@suse.de>, Andrew Morton <akpm@osdl.org>
Subject: [patch 2/2] x86_64: pageattr remove __put_page
Date: Wed, 18 Jan 2006 16:03:49 +0100 (CET)	[thread overview]
Message-ID: <20060117150325.7411.52002.sendpatchset@linux.site> (raw)
In-Reply-To: <20060117150307.7411.94174.sendpatchset@linux.site>

Remove page_count and __put_page from x86-64 pageattr

Signed-off-by: Nick Piggin <npiggin@suse.de>
Acked-by: Andi Kleen <ak@suse.de>

Index: linux-2.6/arch/x86_64/mm/pageattr.c
===================================================================
--- linux-2.6.orig/arch/x86_64/mm/pageattr.c
+++ linux-2.6/arch/x86_64/mm/pageattr.c
@@ -45,6 +45,9 @@ static struct page *split_large_page(uns
 	pte_t *pbase;
 	if (!base) 
 		return NULL;
+	SetPagePrivate(base);
+	page_private(base) = 0;
+
 	address = __pa(address);
 	addr = address & LARGE_PAGE_MASK; 
 	pbase = (pte_t *)page_address(base);
@@ -137,23 +140,20 @@ __change_page_attr(unsigned long address
 			set_pte(kpte,mk_pte(split, ref_prot2));
 			kpte_page = split;
 		}	
-		get_page(kpte_page);
+		page_private(kpte_page)++;
 	} else if ((kpte_flags & _PAGE_PSE) == 0) { 
 		set_pte(kpte, pfn_pte(pfn, ref_prot));
-		__put_page(kpte_page);
+		BUG_ON(page_private(kpte_page) == 0);
+		page_private(kpte_page)--;
 	} else
 		BUG();
 
 	/* on x86-64 the direct mapping set at boot is not using 4k pages */
  	BUG_ON(PageReserved(kpte_page));
 
-	switch (page_count(kpte_page)) {
- 	case 1:
+	if (page_private(kpte_page) == 0) {
 		save_page(kpte_page);
 		revert_page(address, ref_prot);
-		break;
- 	case 0:
- 		BUG(); /* memleak and failed 2M page regeneration */
  	}
 	return 0;
 } 
@@ -214,6 +214,7 @@ void global_flush_tlb(void)
 
 	flush_map((dpage && !dpage->lru.next) ? (unsigned long)page_address(dpage) : 0);
 	while (dpage) {
+		ClearPagePrivate(dpage);
 		__free_page(dpage);
 		dpage = (struct page *)dpage->lru.next;
 	} 

      parent reply	other threads:[~2006-01-18 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-18 15:03 [patch 0/2] x86_64: pageattr cleanups Nick Piggin
2006-01-18 15:03 ` [patch 1/2] x86_64: pageattr use single list Nick Piggin
2006-01-18 19:38   ` Jason Baron
2006-01-19 14:01     ` Nick Piggin
2006-01-18 15:03 ` Nick Piggin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060117150325.7411.52002.sendpatchset@linux.site \
    --to=npiggin@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox