From patchwork Sat Jan 21 07:10:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13111008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB08AC004D4 for ; Sat, 21 Jan 2023 07:11:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 926466B0074; Sat, 21 Jan 2023 02:11:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D5EE6B0075; Sat, 21 Jan 2023 02:11:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79E166B0078; Sat, 21 Jan 2023 02:11:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6ACC06B0074 for ; Sat, 21 Jan 2023 02:11:06 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 43853160F6C for ; Sat, 21 Jan 2023 07:11:06 +0000 (UTC) X-FDA: 80377934532.07.0B75FBA Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 8E3A010000D for ; Sat, 21 Jan 2023 07:11:04 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ovyG/4CM"; spf=none (imf05.hostedemail.com: domain of BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674285064; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5+yIJbbq41O5DQj1Bid/P+oY4/gY3/DwnrWQQ9o5sRM=; b=xkVfPBunDtXtIZCECLO/TwWU6OQvgr2gROMk3QA2qE+y2JjA9kdty3aJYr0zuW2pObC/hA RXD+wcUOD/5fth7a+4jvxIIhvvL9vQV/sm0QBE6F5LbEoPVdeD/xsWDFFnz/9W6iwvYjX4 C5kdz5TKGItM5/SWljnS+m4fveYPxcM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ovyG/4CM"; spf=none (imf05.hostedemail.com: domain of BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+1651c3ebed9361b307e7+7090+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674285064; a=rsa-sha256; cv=none; b=vB3L08pNPihCePksm8HiWcLfd1oEy8is3x/issRl7o1pLDhE5tD8SrIVhWFUCwRFGM3iNe XzNgRd6zSuorR17veN9AgL6v1FoG5ZiMhM8Y0ol5574h/kOb/ga1OdGptSQ1mSYxSJYAvh W8CcN0Hukk4P7vKg9Oj8xtU0mX5QHg4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=5+yIJbbq41O5DQj1Bid/P+oY4/gY3/DwnrWQQ9o5sRM=; b=ovyG/4CMuYwsiX9e0jV8DpYMTM l4eDRY3sfXqwakMNYgYBLwppN9lG2Jm/at9dKrY/Vv7E7C3vCmR9P9CZLwEmoNlVBgyP7ahs7ri49 4kEOTrfK79qSI1gFOJuijAQepIBDCY2Jhhtbp6bMZjftR8jzV7WE4z2D9s8tWDF+CxrCujhCYrjlf ovi/aJW2MKeHy9Sh5IHPkAoGr53Y3QWKYwjixOsPdLKBaOtBQClD2yRiKHXB7frqOucAf4HGvIqRC PQhMmtBP7kpuRBaxUj5/MGDCl7cTYaWs0Evryo0iuAH5PRQS6s74TP3TaARaDeWgaST9rfX8WDw6z xNWyYgwQ==; Received: from [2001:4bb8:19a:2039:6754:cc81:9ace:36fc] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJ81j-00DTmf-0Z; Sat, 21 Jan 2023 07:10:59 +0000 From: Christoph Hellwig To: Andrew Morton , Uladzislau Rezki Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-mm@kvack.org Subject: [PATCH 02/10] mm: remove __vfree Date: Sat, 21 Jan 2023 08:10:43 +0100 Message-Id: <20230121071051.1143058-3-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230121071051.1143058-1-hch@lst.de> References: <20230121071051.1143058-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 8E3A010000D X-Stat-Signature: gzn4rtmwo6gug7n53ghusa6nqe8xnd7u X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1674285064-871299 X-HE-Meta: U2FsdGVkX19ckAnM0RlPk+KnA1RL03pMZJS9bhIERNVLu31NRvA2vx6nNKSOB1GLMQ0uNFRIICoC5OB5eIGE81jV5PnHNJtnZJozsdPkECQVLwsYVwM9W/KnJ+sY9xfywFbcJOQqAoK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4rxM9ZZ6iA6k5/brQ2neVEEQJFsldV7izFbnlDhvxJW/g3gjbYiwZAgStUo2c0fgNpjIvE5BOP2ALBTO1dWhD6ZJg2wzTb3vAAsougw1izOVMrPM3anagZ4WOiSl9f5vb/m8Sz6W4jh4qyjpzd6bfGovWCxUWJXuIRfeIip6ig70bx1UQjPj3VUOLefIIN+b/3vqs2d7LG1Gsx/UUqmJs+raFQApE7qS69hxUzdbkJRYRJPsGRshYWiEml7IDERC0ToMM/RhVfHswCk3PGGhE5UErcl8Mjn2e8PfIHV1giSGDPHJ45o/rZOkGvnDchYZQaOPBhi/cmWyAHDGkRMvW0d0AYxlkxOP5V3LwWb0Kf X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: __vfree is a subset of vfree that just skips a few checks, and which is only used by vfree and an error cleanup path. Fold __vfree into vfree and switch the only other caller to call vfree() instead. Signed-off-by: Christoph Hellwig Reviewed-by: Uladzislau Rezki (Sony) Reviewed-by: David Hildenbrand --- mm/vmalloc.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 6957d15d526e46..b989828b45109a 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2801,14 +2801,6 @@ void vfree_atomic(const void *addr) __vfree_deferred(addr); } -static void __vfree(const void *addr) -{ - if (unlikely(in_interrupt())) - __vfree_deferred(addr); - else - __vunmap(addr, 1); -} - /** * vfree - Release memory allocated by vmalloc() * @addr: Memory base address @@ -2836,8 +2828,10 @@ void vfree(const void *addr) if (!addr) return; - - __vfree(addr); + if (unlikely(in_interrupt())) + __vfree_deferred(addr); + else + __vunmap(addr, 1); } EXPORT_SYMBOL(vfree); @@ -3104,7 +3098,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, /* * If not enough pages were obtained to accomplish an - * allocation request, free them via __vfree() if any. + * allocation request, free them via vfree() if any. */ if (area->nr_pages != nr_small_pages) { warn_alloc(gfp_mask, NULL, @@ -3144,7 +3138,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, return area->addr; fail: - __vfree(area->addr); + vfree(area->addr); return NULL; }