From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752476AbYKRIyb (ORCPT ); Tue, 18 Nov 2008 03:54:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751250AbYKRIyV (ORCPT ); Tue, 18 Nov 2008 03:54:21 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:52710 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1750756AbYKRIyV (ORCPT ); Tue, 18 Nov 2008 03:54:21 -0500 Message-ID: <492281F7.3000107@cn.fujitsu.com> Date: Tue, 18 Nov 2008 16:51:03 +0800 From: Lai Jiangshan User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Andrew Morton CC: Johannes Weiner , David Miller , Dave Airlie , Paul Menage , kamezawa.hiroyu@jp.fujitsu.com, Balbir Singh , Arjan van de Ven , Jan Kara , Jes Sorensen , KOSAKI Motohiro , dada1@cosmosbay.com, Alexey Dobriyan , Jens Axboe , Linux Kernel Mailing List , "Paul E. McKenney" , Nick Piggin , Al Viro , Rik van Riel , Pekka Enberg Subject: [PATCH V2 1/4] vmalloc: introduce vfree_atomic() References: <492162E4.9080902@cn.fujitsu.com> <20081117131440.GB29931@cmpxchg.org> In-Reply-To: <20081117131440.GB29931@cmpxchg.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fdtable and sysipc use vfree() in RCU callback. this patch introduce vfree_atomic() for them. Signed-off-by: Lai Jiangshan --- diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 307b885..195379a 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -60,6 +60,7 @@ extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot); extern void vfree(const void *addr); +extern void vfree_atomic(void *addr); extern void *vmap(struct page **pages, unsigned int count, unsigned long flags, pgprot_t prot); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ba6b0f5..39c164e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -1177,6 +1178,21 @@ void vfree(const void *addr) } EXPORT_SYMBOL(vfree); +static void vfree_defer(struct work_struct *work) +{ + vfree(work); +} + +void vfree_atomic(void *ptr) +{ + if (ptr) { + struct work_struct *work = ptr; + INIT_WORK(work, vfree_defer); + schedule_work(work); + } +} +EXPORT_SYMBOL_GPL(vfree_atomic); + /** * vunmap - release virtual mapping obtained by vmap() * @addr: memory base address