Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933324AbdC3K0o (ORCPT ); Thu, 30 Mar 2017 06:26:44 -0400 Received: from mail-db5eur01on0094.outbound.protection.outlook.com ([104.47.2.94]:8983 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932296AbdC3K0X (ORCPT ); Thu, 30 Mar 2017 06:26:23 -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: CC: , , Andrey Ryabinin , , , , , , , , , , , Subject: [PATCH 4/4] mm/vmalloc: remove vfree_atomic() Date: Thu, 30 Mar 2017 13:27:19 +0300 Message-ID: <20170330102719.13119-4-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170330102719.13119-1-aryabinin@virtuozzo.com> References: <20170330102719.13119-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM4P190CA0004.EURP190.PROD.OUTLOOK.COM (10.172.213.142) To HE1PR0801MB2058.eurprd08.prod.outlook.com (10.168.95.23) X-MS-Office365-Filtering-Correlation-Id: eee53dfb-2410-4708-6148-08d47757331f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:HE1PR0801MB2058; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2058;3:xFdPQT2MYrePdJ0P9Er0oDX2rmmXxBOwhdkgWlf6aa0ALK+3V6erV9gGtMRhj1L8E1G/n6QsZ75YqJ77ZsFbwNdy+OoMSC8VT1919I8QU0k2FEp5a1uwBFYNeW/D4Zuz2Mp+4V1d/UowFyPptBtgqbiYScPsRxeujAtK58EuLHIkRHymAF4XbrpkeoOQMYcPXPkhycaEYqquCttkr2kgj9FMmmy6S7jPJeCyKaVzh9CDTlz378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6RxuUaAwTmaf8n6IoM0NadQGQaGLh0aStjzrGt9tbFmeMPcCa6P9V4i9SEq53oWPf1WBjq3YE+Yu7pCw3CEMYQamxXRjiuJE7GeS5pXS0k4Zwx+HVFDnY7In9bUVqzMwDcH4enrUr1JTODuz8CVqwTeuwH2gFj3wqyK22MXOsO3XM3xZUqBZ+1lJsunnzWCteNCPVchccRrG8= 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)(6041248)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123564025)(6072148);SRVR:HE1PR0801MB2058;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB2058; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2058;4:Di5TmNGJ19Kzrg/adcuYOoqAFR51bO4hh8+icDJyMeHtcxln0BkWDEVXl15CO6lMvk7FXX1f1R3U6ZgJjRVF5m7rWlyQew9g+GpcIoLea8kwGnCnouYDGO9eK9FqPcbOXHu2p00TgczD5R/AOXwckJltLnPLYp3DTGy4Zm5sFR9SgXqaub8hWGr0xfUxQ8itwFhk4b0sOz1YVoivr/Hih1chxZiew03oI0XoFDgi5WwS/zP3xIAVIwiynZJV9u1n4tvqu5kZtuHO9nlkOtTl/mVOiI+Bssiuj5HoKFeHADXHx/xd/Haknp7W2pE8cN8gQo3+ZEfSRtQcM9i5d8mQ282fvIj4JmNcaoCZpfnNbLsoaTulqaP1UzLDY/Y8PNsSc+nmG7u+IJyXC3kXQWdBY0ljF+4ifwN2Dta78ccViKrPZdu+90irAfU6ueHuaZXzVG+anwV++mgovUhYPWY7hfiGRdZGqVdAmpfB53O3tNlTpAjeTrAd7YIam+DLZY22wpgrV0lE9VI0N5bvdqEE7oKdKLac1gu8PgJWFcJuYbC5La8er06gYHsnlfKSg4fgRGUThN1iS0xr8lcqNV1Fm5uyCKQDjFj9T9xoLXhUVvotzKkYZA7r6pzU61PiK2gm8bUZ/bogdllibcFkWLit3on8SWjAHInKbpBRr1+8nRE= X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6069001)(39840400002)(39410400002)(39450400003)(39400400002)(7736002)(50466002)(6506006)(36756003)(86362001)(38730400002)(6486002)(305945005)(6512007)(189998001)(2351001)(1076002)(110136004)(54906002)(53416004)(42186005)(81166006)(2950100002)(53936002)(8676002)(6916009)(7416002)(48376002)(76506005)(66066001)(5660300001)(76176999)(50986999)(50226002)(33646002)(3846002)(6116002)(25786009)(2906002)(47776003)(5003940100001)(4326008);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB2058;H:localhost.sw.ru;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR0801MB2058;23:bKLBvvWuHVe4jnkKFQNLM+TjGxiZ2m/5h0Sg1h9?= =?us-ascii?Q?yIMKE7VJ51ukI7dScU1QBW+mWMwaU55tFIxb0SMonuGKFB9mZ+3Ed25vEKsW?= =?us-ascii?Q?EuWmqe0QTcCNCfXdYw7bB1xKeMjiDW7KXTc7gJUurSKfFS3XlRMDWYXks5XG?= =?us-ascii?Q?iUJclO3tU6QfV2WeJauUxSIEIPTYzvRTp/F/3NEJLu+vlEOCnCcDnCcluQCw?= =?us-ascii?Q?yBChjP2XLTV5xWeOPBCs1jLWj75xNGPxmKhKxg6e40q4+lqTSZYPGTHUpyQn?= =?us-ascii?Q?EDkbW1rnmhApOe8wJAd0vWsewqc+S9hhuuvqIO8J3D3sdHUmRNGichQVfIv5?= =?us-ascii?Q?3Q3vWKGhbrrwY3BZZ3oauASfRLrMNJjcidExsX+AMbD5RZBCzjzPuQjpglu4?= =?us-ascii?Q?v/hNkt+UT47eKN+z0xw8UmMAZ/BUe/Rh9L033DeB+M9HkhL9+gRwdL+GBoYQ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5bbSrRWDMewT/iDXtUr5MtnwN5IO1ilfDa4w62axMeudec6v6/Uqf6lMISuauPD7rim2mu6O214MOeJeseBlHVB7YXQTOl5GUQ0h3wxIV9geuaaK6HbgJC28jI9mN7+HGIAlLRINeTg2Dux1xjMq39R1YBkt0yR9rhYqbwb7GC3+thQXqw==;5:iEzEodzA8ptRwHdbSBN47ateZ7AcLdsOapjphH4Tzsg3UwZHMFv0QCTRkP+7j8bBzsfu2R6zX+T6906NgoBaPKF2YR8NBzerYwygCeCQ827rd3Sle19RSthFECbogXjGu5G7eO1IPndcRlvXT0cYyw==;24:QoR4eOgb6ngyu4aM+B6P9CTTKCXA6H2EHURPPgiRmYV9IB6potMfBdySAW8EtRt1EMimUTuklSUuTYChv3mbNrqkKaW1c51m2A7LiE6HNO0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2058;7:Y1KgFREvAuPgodqeJJ5QzTdBbD2yv+MQXTQRp4T/Em/J/lSEb/83CvGa0Kjs029uVfxxhSVdD/KfW+VdLPDZY2PKZWYP27Rk9/J6WR+mMXQHnu596V8Ub4JAYvUn0H+NyjnrenIuAmKPvxQe4zpYR945TUQD+zDNMtCp1bZ9U5PUSLWDEUDisJYeVU6kV3GVTvmKl7sf6tblFA3ToDlnQbtZ5F0Fd6mnfA/CY12xBX/4bLJObNP7ZwHpGxGAoxGKbGP1iZVWzYJx/tCxlWhO0gFStztQ9yANJ1KnPot8RiYjvt3xCpZfc4HCXKJlpAtQBQTUQhYISqSDbwr/UOGpEw==;20:50FQXg53nLbTLDCbqNaEHYTRpjLzDE4x/7VFbQfTKIKVoIVJZlWkku1UQ86kmPBbYk9QYGsVMeV3dK6pbpjc21MYHgxh4dWz6USb1IpvM9QVccHECK+F8KyzK5V+0VB7bQohtIcJMIwOUGiPu2PuAS5nuHFewC3fnToR1PzRlyg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 10:26:15.7016 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2058 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2419 Lines: 83 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 --- 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 ea1b4ab..b77337a 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