Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754041AbdDLMue (ORCPT ); Wed, 12 Apr 2017 08:50:34 -0400 Received: from mail-eopbgr00101.outbound.protection.outlook.com ([40.107.0.101]:44640 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753313AbdDLMti (ORCPT ); Wed, 12 Apr 2017 08:49:38 -0400 Authentication-Results: linux-foundation.org; dkim=none (message not signed) header.d=none;linux-foundation.org; dmarc=none action=none header.from=virtuozzo.com; From: Andrey Ryabinin To: Andrew Morton CC: , Andrey Ryabinin , , , , , , , , , , , , , Subject: [PATCH v2 4/5] mm/vmalloc: remove vfree_atomic() Date: Wed, 12 Apr 2017 15:49:04 +0300 Message-ID: <20170412124905.25443-5-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170412124905.25443-1-aryabinin@virtuozzo.com> References: <20170330102719.13119-1-aryabinin@virtuozzo.com> <20170412124905.25443-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0601CA0026.eurprd06.prod.outlook.com (10.166.117.36) To VI1PR0801MB2734.eurprd08.prod.outlook.com (10.166.198.27) X-MS-Office365-Filtering-Correlation-Id: 835643f5-261b-4153-bafe-08d481a25bac X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:VI1PR0801MB2734; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2734;3:r/CQETl3JH8WSQ0uoi7ijAFf/VguwsUvSIbzNYFHUmkz0b1QrqBlpWOcQ4xaH778nCpgw/1iOicKB4qSqdz5JkaLnR2sk46o8gIl9a/2alZgz85gHa1WNZkmkzex0TgYCgfi/hPnS8UXvLfFap+r9Qa33sNcWVflHWzZNi0xCIxjkjWpmBHjl99DrMn93qFj4Hi5FFOVev3BqxgV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if9yt6QWuFvkIGiTEnExCC/i4rSkL0cdKM4pT08Si0aqade3RbVtVP/meQzacAV+Rnxl0MUDLgymm7wM/yLzIg6i3dBOad8G0LZDF5vMvGWkTUn6xF25ERgLQiY6J1ZgrNvD7gBya+w5LbS6+iAjVcMfoEzUR5MYKUYXLVkul4KAIMV/pB4RfKtq7lSR05a3CO20tglNtc3g6ZycGqySblJZApHPcb4h+Jai/tx9Zy6qa2fWo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123564025)(6072148);SRVR:VI1PR0801MB2734;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2734; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2734;4:jGqUwhgSWIleLSnu/AOdiux8UM+VIs81//zpHVrunTBh8p884/zzfaNgfNBdso9NZbE2FdGLiMmLs0cgoeMELQ8+lYwNxHC5Pi1iY+FUNzrGBoX8o8r1Vl+3j7vAr8o34u7jLYY/NZrgFt5Zcgb3V0fS1QuIaXFYxWWm3yrmc0zUb0dNogMAgx0V0GTtvjPzf008txYyV8vr4nAbpyDwOM6yOzuCRWd2TuG19kS7ywgrfluuaVt6OWZtiSEO1p5vD8InK/nU3ghMmnVWXgHTgu5s/yN2oNHqqQvl29beO9qplmn/KQK4pPYHFJ5b7UPeV4ii15x/6irJ6rub35vetNLPvzwSfZsjSsQ8bxmC10vyD/j/tDNNWeIKpm4JC7W6EZuIXM+sa9yBEOfy79/imZEJ96xb3Fv8wGhYhlp5zCHlmBO539g3LmWK169XRXV1s29KTcAVLMDF/vtr9F2Dj0J6IP19ST3wJSKMKZqoNcIGYuJg2FXfHo+yOu4Y0ILEWJpRkEuw2EzGdg40mYGsaM+t4vefXxNN61il7N5YsjpjwBWxz3xOJ0nnNJlLx6De0UZWCmmWICF735N9OkaIjdO+Pok1UWu5KrvkHROk8CvnDj+vpopnzEC7+PHP/Ya6At/zTtPOPVJjWQdG6Nj2gRldbeDqOYVX7sfaR7X/VWJ1O2uDuH4Euv4iuDFy9WwXB4EA8nt20hFDIgEExiXukg== X-Forefront-PRVS: 027578BB13 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6069001)(6009001)(39400400002)(39410400002)(39830400002)(39450400003)(42186005)(25786009)(53416004)(3846002)(33646002)(6116002)(76506005)(305945005)(50466002)(53936002)(4326008)(575784001)(86362001)(8676002)(5003940100001)(38730400002)(2950100002)(1076002)(6916009)(2906002)(50226002)(189998001)(110136004)(48376002)(6666003)(6486002)(5660300001)(6512007)(36756003)(54906002)(6506006)(7416002)(81166006)(50986999)(76176999)(7736002)(47776003)(66066001);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2734;H:localhost.sw.ru;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0801MB2734;23:d2uCrDv1/KpQBOTXmAS42bp1DN/WcP7pnd+4zHN?= =?us-ascii?Q?rm5GvsR6grbnBFNMNhr4S5S7WM5jf2AFdKo5hsp4SPKXiSYmKjLglPN5in5w?= =?us-ascii?Q?yMo7ila7iaaaekjHlYPohuorhVb8WxwJSNJwNqgkkoE3bhydkm9cc4M+dHWv?= =?us-ascii?Q?CvB0axsIaXwSIZK0CCKAZhS/k4y9pCagO9esX7rLlY74NBeVghi4BbDJGsTb?= =?us-ascii?Q?MoQLuXHFhrDTT+Pwg3EPMEiuYuzOnRD/L4dKNtkd3SYG78OO84JNNC6c0wtR?= =?us-ascii?Q?tJroHkSh4naw3Id5+0cabWia/Z2ZynogZr0VYEwpV61vGWBKHdeW3+QtE6DE?= =?us-ascii?Q?+bHPR0PUd3kVj5rGtGDnG0e2assyFpSKZoicaJankoxdHvUYLZEpdd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b13d93x4y42lfX4XGbQyXf6O7zULzArQVox4op0FvBVDYZWOL9L1HSOMXjkJFlPA7RAuEXJuoAXCRaNMlzrfTlKMrvBdw+RFWYstufXbJz7CZ+UgcbRrKAHe3QNuZ3IbanAK5YVwY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2017 12:49:27.3188 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2734 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2460 Lines: 84 vfree() can be used in any atomic context and there is no vfree_atomic() callers left, so let's remove it. This reverts commit bf22e37a6413 ("mm: add vfree_atomic()") Signed-off-by: Andrey Ryabinin Acked-by: Michal Hocko --- include/linux/vmalloc.h | 1 - mm/vmalloc.c | 40 +++++----------------------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 46991ad..b4f044f 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -83,7 +83,6 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align, extern void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags); extern void vfree(const void *addr); -extern void vfree_atomic(const 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 1c74b26..ee62c0a 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1534,38 +1534,6 @@ static void __vunmap(const void *addr, int deallocate_pages) return; } -static inline void __vfree_deferred(const void *addr) -{ - /* - * Use raw_cpu_ptr() because this can be called from preemptible - * context. Preemption is absolutely fine here, because the llist_add() - * implementation is lockless, so it works even if we are adding to - * nother cpu's list. schedule_work() should be fine with this too. - */ - struct vfree_deferred *p = raw_cpu_ptr(&vfree_deferred); - - if (llist_add((struct llist_node *)addr, &p->list)) - schedule_work(&p->wq); -} - -/** - * vfree_atomic - release memory allocated by vmalloc() - * @addr: memory base address - * - * This one is just like vfree() but can be called in any atomic context - * except NMIs. - */ -void vfree_atomic(const void *addr) -{ - BUG_ON(in_nmi()); - - kmemleak_free(addr); - - if (!addr) - return; - __vfree_deferred(addr); -} - /** * vfree - release memory allocated by vmalloc() * @addr: memory base address @@ -1588,9 +1556,11 @@ void vfree(const void *addr) if (!addr) return; - if (unlikely(in_interrupt())) - __vfree_deferred(addr); - else + if (unlikely(in_interrupt())) { + struct vfree_deferred *p = this_cpu_ptr(&vfree_deferred); + if (llist_add((struct llist_node *)addr, &p->list)) + schedule_work(&p->wq); + } else __vunmap(addr, 1); } EXPORT_SYMBOL(vfree); -- 2.10.2