From patchwork Thu Jan 19 10:02:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13107649 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 4AABEC004D4 for ; Thu, 19 Jan 2023 10:02:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB5146B0078; Thu, 19 Jan 2023 05:02:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3D676B007B; Thu, 19 Jan 2023 05:02:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2BF76B007D; Thu, 19 Jan 2023 05:02:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B7D146B0078 for ; Thu, 19 Jan 2023 05:02:47 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8C432140CAB for ; Thu, 19 Jan 2023 10:02:47 +0000 (UTC) X-FDA: 80371109574.29.C3F5E6F Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 24669100013 for ; Thu, 19 Jan 2023 10:02:45 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="mLU4/4FN"; spf=none (imf05.hostedemail.com: domain of BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+d6c99cb0ec1a2cfa7d20+7088+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=1674122566; 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=/gC0OwkR0jaMw4/imRoa+Guq6kwX6Vfz518yrgqHDK8=; b=V1hBHpAE9j28W2el4+9tZbVpjY4w2yyrzfJ4EeF6o83mjFTPTG2XdXmwPCGyiFE3awwVYR nczJQPpaHYNmNuREr6Qe8icGPxTLQGW4wxQfglanRzOWH3xhtjPhXD9E2RusYt2dGTTHMU IdhQziISrJJ3uBiXQwOtitcxshcjyJ0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="mLU4/4FN"; spf=none (imf05.hostedemail.com: domain of BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674122566; a=rsa-sha256; cv=none; b=p4Zc9TfPtFjFbIZAFXZBR235CSVubfzX4Fz+m1h4R0ET1gGlgBNADUyZjLoRvr4F5RhvYU 3UJ/npRjoQkBYVeDbqhrqdSiY9P8DUPPt1U6JLkNX286e6LpyNmHZwCE5tWFW2HfNHhkyk Rr8cWIi8w4inzOPjnbvVxSemkraRF8A= 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=/gC0OwkR0jaMw4/imRoa+Guq6kwX6Vfz518yrgqHDK8=; b=mLU4/4FNnOluiMgeY94YjOwYrK DvgjdklKB/A8LjJvxw4R6pFxmcemZ2m8k+hNL+5hC0KYtTuwWoyQzqddyZD2Mz6xiw6ruejjwe1uQ M9BWERVlumI1SmBUBDwQ7YeYbPk3BZhfwV1yNdrTuC7opwDyLnUuhts9RNsjmUrnj9fVXiLn0QeEv dtjJbY83CxRfPwD+hYrcWwQa4ucc/U1gyba6TGLK8EnxqICNEbyf4DQqqL3JWej0vqE99tASyhJuF Ijo4TImzkQMbJQVC67LWj5fn1+ECTaLwa7jz6becjqCGcz04Ex+cD80+VUcJwF50Io1CEpCiutNkX kN9JXmKw==; Received: from 089144197172.atnat0006.highway.a1.net ([89.144.197.172] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIRkn-004LXA-6G; Thu, 19 Jan 2023 10:02:41 +0000 From: Christoph Hellwig To: Andrew Morton , Uladzislau Rezki Cc: linux-mm@kvack.org Subject: [PATCH 02/10] mm: remove __vfree Date: Thu, 19 Jan 2023 11:02:18 +0100 Message-Id: <20230119100226.789506-3-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119100226.789506-1-hch@lst.de> References: <20230119100226.789506-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 24669100013 X-Stat-Signature: xq6ngzygnmj3wyihcdiq1zqjjcdejua6 X-HE-Tag: 1674122565-519959 X-HE-Meta: U2FsdGVkX1+8PIvE1VQQZoycrAd5hu1qKoI9YoKc3WDRfk/cpyp6yZ1YRY/meKQghojY5CeQy7aZMR7oCDZde2rADKCwthWnBW+ct2SVVKTOHlLUhoSr60rJC75MM8VJiG4SPyYuE2c61U7rJyR7weLm1CULm6CWBZphvqISyLHzBtgQSGobFHquC9X967TJ56Zf8q9NIjz2+/ROBIi/LGDu3yEXYzPdBM1qXTZ1QgkO35Vmc2CKpuZFVf3dIQr8lOUKhfp7GPmusQ9Nbg+Xzsf7NnF+vF7fi3e4A681uNv+MVp7vNjBa20khcBaJsHmnq2Uy3LoTY6WxtbpAnaf0rlBDXc2+ESUBBGJXSaVMeMtevl/6ODhVoSMYqPpDWj3X+GvLRqnoRaLwRnnF5g5LMnRDIrLhdEiE+sPt6QqUlvHjP00xSiI/c5NBfpqfJIYsJRPMHFnu2I92J+5AaqESkqs47NITquHt8oySwRF/ZjdPxLi95lZXuRJkKHbtrvAb9sKEhX5alhpCZx1g5t8ie32J5B6xjU2IMKmyUL+FfEZUmybhqwFCD3X2wCp+cOD+86uYiCxffUJLVbrzZYcpaga9peJ6yEO8xUf/mtEak6sRwHOWEGivP2CLTczdRk8WyhX4ce7sihkh/xTx8WgCT64CYMPoGX9OaHgq6IUnh3DK/rflY9b95iI8oo8mGshsjhPnSBpYKJ4yD+CbDYUMi51Jxyi4jIGNOmn4jc8MbQQrq7LXurwMbQzS7GTWNpum6X0v7Nn9LAktAwE0HOfExcCnsdSx4zf5YKf0x57QY/p1uGEcxfX7nL2c9zIyS7221Bw+0PINEJhXQqvGGFv2enSAWkLL+4z81QymCLlBXJlAKhYjCi/BjJaxjTL83fAXvTezYEeaAnaCgK1x39t8ODwZXSV9Kh7FONEaNL+qvW7Zgwil2zWn3utNad8Wk5j34cxMKMK1y+wMhPYqm8 BOiUkiNF QOsy6SwjaCQho6yvdSpkWepCqN/pX2hJYRrebxSwsrOfe1pMts7xO1nvZNri/guD/MwOgh90ado9E12xrHZgtffpeQcYgwB29hd6vMFvzSS5BvSRxeoOrLVtAGfKedHzDdDF9/jUKnHsKMUwDhHsFfRAIheY/9TimAc+KNToKDQUSN7nu+fJX0+wpDpclCzp9zypoB4jc6BhOfYzF5ApAcfQfA46tlEbDgAEzSAKFXGp5a3w= 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) --- 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; }