From 68151379419236151cf8eb10c342d366ebd9d1bb Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 3 Oct 2007 20:42:46 -0700 Subject: [PATCH] vcompound: Virtual compound page freeing in interrupt context If we are in an interrupt context then simply defer the free via a workqueue. Removing a virtual mappping *must* be done with interrupts enabled since tlb_xx functions are called that rely on interrupts for processor to processor communications. Signed-off-by: Christoph Lameter --- mm/page_alloc.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) Index: linux-2.6.25-rc5-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.25-rc5-mm1.orig/mm/page_alloc.c 2008-03-19 20:26:37.430738781 -0700 +++ linux-2.6.25-rc5-mm1/mm/page_alloc.c 2008-03-19 21:13:22.109290879 -0700 @@ -339,10 +339,20 @@ static void __free_vcompound(void *addr) kfree(pages); } +static void vcompound_free_work(struct work_struct *w) +{ + __free_vcompound((void *)w); +} static void free_vcompound(void *addr) { - __free_vcompound(addr); + struct work_struct *w = addr; + + if (!preemptible()) { + INIT_WORK(w, vcompound_free_work); + schedule_work(w); + } else + __free_vcompound(w); } static void free_compound_page(struct page *page) @@ -1631,23 +1641,26 @@ static noinline struct page *alloc_vcomp if (!page) goto abort; - /* Sets PageCompound which makes PageHead(page) true */ + /* + * Sets PageCompound which makes PageHead(page) true. + * prep_compound_page will fix things up later + */ __SetPageVcompound(page); pages[i] = page; } vm = get_vm_area_node(nr_pages << PAGE_SHIFT, VM_VCOMPOUND, - zone_to_nid(zonelist_zone(zonelist->_zonerefs)), - gfp_mask); + zone_to_nid(zonelist_zone(zonelist->_zonerefs)), gfp_mask); + vm->caller = __builtin_return_address(0); pages2 = pages; if (map_vm_area(vm, PAGE_KERNEL, &pages2)) goto abort; - prep_compound_page(pages[0], order); - for (i = 0; i < nr_pages; i++) - set_page_address(pages[0], vm->addr + (i << PAGE_SHIFT)); + set_page_address(pages[i], vm->addr + (i << PAGE_SHIFT)); + + prep_compound_page(pages[0], order); return pages[0];