login
Header Space

 
 

[PATCH CPA] [11/28] CPA: Change 32bit back to init_mm semaphore locking

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Date: Thursday, January 3, 2008 - 11:24 am

Now that debug pagealloc uses a separate function it is better
to change standard change_page_attr back to init_mm semaphore locking like 64bit.
Various things are simpler when sleeping is allowed.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/mm/pageattr_32.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Index: linux/arch/x86/mm/pageattr_32.c
===================================================================
--- linux.orig/arch/x86/mm/pageattr_32.c
+++ linux/arch/x86/mm/pageattr_32.c
@@ -14,10 +14,9 @@
 #include <asm/pgalloc.h>
 #include <asm/sections.h>
 
-static DEFINE_SPINLOCK(cpa_lock);
+/* Protected by init_mm.mmap_sem */
 static struct list_head df_list = LIST_HEAD_INIT(df_list);
 
-
 pte_t *lookup_address(unsigned long address, int *level)
 { 
 	pgd_t *pgd = pgd_offset_k(address);
@@ -46,9 +45,7 @@ static struct page *split_large_page(uns
 	struct page *base;
 	pte_t *pbase;
 
-	spin_unlock_irq(&cpa_lock);
 	base = alloc_pages(GFP_KERNEL, 0);
-	spin_lock_irq(&cpa_lock);
 	if (!base) 
 		return NULL;
 
@@ -224,15 +221,14 @@ int change_page_attr(struct page *page, 
 {
 	int err = 0; 
 	int i; 
-	unsigned long flags;
 
-	spin_lock_irqsave(&cpa_lock, flags);
+	down_write(&init_mm.mmap_sem);
 	for (i = 0; i < numpages; i++, page++) { 
 		err = __change_page_attr(page, prot);
 		if (err) 
 			break; 
 	} 	
-	spin_unlock_irqrestore(&cpa_lock, flags);
+	up_write(&init_mm.mmap_sem);
 	return err;
 }
 
@@ -243,9 +239,9 @@ void global_flush_tlb(void)
 
 	BUG_ON(irqs_disabled());
 
-	spin_lock_irq(&cpa_lock);
+	down_write(&init_mm.mmap_sem);
 	list_replace_init(&df_list, &l);
-	spin_unlock_irq(&cpa_lock);
+	up_write(&init_mm.mmap_sem);
 	flush_map(&l);
 	list_for_each_entry_safe(pg, next, &l, lru) {
 		list_del(&pg->lru);
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 5:31 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 5:53 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:43 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 7:07 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 8:22 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 8:39 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:04 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 6:07 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:57 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 7:12 am)
Re: CPA patchset, Ingo Molnar, (Fri Jan 11, 3:19 am)
Re: CPA patchset, dean gaudet, (Fri Jan 11, 1:02 pm)
Re: CPA patchset, dean gaudet, (Fri Jan 11, 1:56 pm)
Re: CPA patchset, Arjan van de Ven, (Fri Jan 11, 1:18 pm)
Re: CPA patchset, Andi Kleen, (Fri Jan 11, 7:26 am)
Re: CPA patchset, Ingo Molnar, (Fri Jan 11, 3:33 am)
Re: CPA patchset, Andi Kleen, (Fri Jan 11, 7:28 am)
Re: CPA patchset, Dave Airlie, (Thu Jan 10, 5:44 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:02 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 5:55 am)
Re: CPA patchset, Dave Airlie, (Thu Jan 10, 6:20 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 6:50 am)
[PATCH CPA] [9/28] CPA: Add simple self test at boot, Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [11/28] CPA: Change 32bit back to init_mm semaph..., Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [6/28] CPA: Undo white space changes, Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [5/28] Add pte_pgprot on i386, Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [4/28] Add pte_clrhuge on i386, Andi Kleen, (Thu Jan 3, 11:24 am)
Re: [PATCH CPA] [4/28] Add pte_clrhuge on i386, Jeremy Fitzhardinge, (Sat Jan 5, 2:48 am)
speck-geostationary