Skip to contentSkip to conversation

pgtables: fix GFP_KERNEL allocation with preempt disabled

PATCH In review Martin Hicks 3 participants 4 messages Apr 19, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pgtables: fix GFP_KERNEL allocation with preempt disabled

Hi Andrew,

This is a fix to the pgtable_quicklist code. There is a GFP_KERNEL allocation in pgtable_quicklist_alloc(), which spews the usual warnings if the kernel is under heavy VM pressure and the reclaim code is invoked.

This patch is against 2.6.12-rc2-mm2

include/asm-ia64/pgalloc.h +1 -1
Index: linux-2.6.12-rc2.wk/include/asm-ia64/pgalloc.h
===================================================================
@@ -50,7 +50,7 @@ static inline void *pgtable_quicklist_al
 		ret[0] = 0;
 		--pgtable_quicklist_size;
 	} else {
-		ret = (unsigned long *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+		ret = (unsigned long *)__get_free_page(GFP_ATOMIC | __GFP_ZERO);
 	}
 
 	preempt_enable();
#1 lore raw
Quoted 6 lines · On Tue, 19 Apr 2005 13:04:13 -0400 Martin Hicks <[email protected]> wrote:

This is a fix to the pgtable_quicklist code. There is a GFP_KERNEL allocation in pgtable_quicklist_alloc(), which spews the usual warnings if the kernel is under heavy VM pressure and the reclaim code is invoked.

This patch is against 2.6.12-rc2-mm2

I think you should really drop the preempt disable during this allocation instead, that's what we do in the sparc64 quicklist code.

It's very simple, change the code to:

		preempt_enable();
	} else {
		preempt_enable();
		ret = (unsigned long *) ...;
	}
	/* preempt_enable() no longer here */
#2 lore raw
Quoted 4 lines · David S. Miller

I think you should really drop the preempt disable during this allocation instead, that's what we do in the sparc64 quicklist code.

Okay, here's an updated patch.

Hi Andrew,

This is a fix to the pgtable_quicklist code. There is a GFP_KERNEL allocation in pgtable_quicklist_alloc(), which spews the usual warnings if the kernel is under heavy VM pressure and the reclaim code is invoked. re-enable preempt before we allocate the new page.

This patch is against 2.6.12-rc2-mm2

 pgalloc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/asm-ia64/pgalloc.h +2 -2
Index: linux-2.6.12-rc2.wk/include/asm-ia64/pgalloc.h
===================================================================
@@ -49,12 +49,12 @@ static inline void *pgtable_quicklist_al
 		pgtable_quicklist = (unsigned long *)(*ret);
 		ret[0] = 0;
 		--pgtable_quicklist_size;
+		preempt_enable();
 	} else {
+		preempt_enable();
 		ret = (unsigned long *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
 	}
 
-	preempt_enable();
-
 	return ret;
 }