block: initialize the bounce pool if high memory may be added later
PATCH 1/1 block: initialize the bounce pool if high memory may be added later
init_emergency_pool() does not create the page pool for bouncing block requests if the current count of high pages is zero. If high memory may be added later (either via memory hotplug or a balloon driver in a virtualized system) then a oops occurs if a request with a high page need bouncing because the pool does not exist.
So, always create the pool if memory hotplug is enabled and change the test so it's valid even if all high pages are currently in the balloon (the balloon drivers adjust totalhigh_pages but not max_pfn).
--- mm/bounce.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
mm/bounce.c +4 -5
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/hash.h> #include <linux/highmem.h> +#include <linux/bootmem.h> #include <asm/tlbflush.h> #include <trace/events/block.h>
@@ -26,12 +27,10 @@ static mempool_t *page_pool, *isa_page_pool;#ifdef CONFIG_HIGHMEM static __init int init_emergency_pool (void ) { -struct sysinfo i; -si_meminfo (&i); -si_swapinfo (&i); - -if (!i.totalhigh) +#ifndef CONFIG_MEMORY_HOTPLUG +if (max_pfn <= max_low_pfn)return 0 ; +#endif page_pool =mempool_create_page_pool (POOL_SIZE ,0 );BUG_ON (!page_pool);
Signature · 1 line
1.7.2.5
Quoted 9 lines · David Vrabel
init_emergency_pool()does not create the page pool for bouncing block requests if the current count of high pages is zero. If high memory may be added later (either via memory hotplug or a balloon driver in a virtualized system) then a oops occurs if a request with a high page need bouncing because the pool does not exist.So, always create the pool if memory hotplug is enabled and change the test so it's valid even if all high pages are currently in the balloon (the balloon drivers adjust
totalhigh_pagesbut notmax_pfn).
Jens, you don't seem to have picked up this patch yet. Should it have gone via Andrew Morton instead?
David
Quoted 33 lines
Signed-off-by David Vrabel <[email protected]>--- mm/bounce.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)mm/bounce.c +4
-5@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/hash.h> #include <linux/highmem.h> +#include <linux/bootmem.h> #include <asm/tlbflush.h> #include <trace/events/block.h> @@ -26,12 +27,10 @@ static mempool_t *page_pool, *isa_page_pool;#ifdef CONFIG_HIGHMEM static __init int init_emergency_pool (void ) { -struct sysinfo i; -si_meminfo (&i); -si_swapinfo (&i); - -if (!i.totalhigh) +#ifndef CONFIG_MEMORY_HOTPLUG +if (max_pfn <= max_low_pfn)return 0 ; +#endif page_pool =mempool_create_page_pool (POOL_SIZE ,0 );BUG_ON (!page_pool);
Quoted 7 lines · David Vrabel
Quoted 6 lines · David Vrabel
init_emergency_pool()does not create the page pool for bouncing block requests if the current count of high pages is zero. If high memory may be added later (either via memory hotplug or a balloon driver in a virtualized system) then a oops occurs if a request with a high page need bouncing because the pool does not exist.
Quoted 6 lines
Quoted 3 lines
So, always create the pool if memory hotplug is enabled and change the test so it's valid even if all high pages are currently in the balloon (the balloon drivers adjust
totalhigh_pagesbut notmax_pfn).Jens, you don't seem to have picked up this patch yet. Should it have gone via Andrew Morton instead?
Added now for 3.2.
Signature · 1 line
Jens Axboe