From patchwork Sat Sep 30 03:30:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13404933 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 093D2E7734F for ; Sat, 30 Sep 2023 03:30:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D5DA8D010A; Fri, 29 Sep 2023 23:30:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9863A8D002B; Fri, 29 Sep 2023 23:30:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 850118D010A; Fri, 29 Sep 2023 23:30:09 -0400 (EDT) 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 743768D002B for ; Fri, 29 Sep 2023 23:30:09 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3F5068061E for ; Sat, 30 Sep 2023 03:30:09 +0000 (UTC) X-FDA: 81291835338.29.0E15171 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by imf19.hostedemail.com (Postfix) with ESMTP id 7C71F1A0008 for ; Sat, 30 Sep 2023 03:30:07 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=M+VP87pE; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of hughd@google.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696044607; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=F5lBL1dIqosEB13vnHNJcMu3nNFm9z6wAJ0sm8x1c/Y=; b=8qdPj/OsMwPSCF8+q2p0eidcSb2QOZ/Dmdis6sOth8n/GEArfNqySdIioEBphqQm0OkrGr DBWwvwSOQVq0u/rEOcN7Ap62Z3moIvIwnfgm/gd01uRcmmL8bfbeTiX2fXI3kZaCacVwQv sjGLdac4Q91AXlPdIsXc7NsnzJ6Ae6s= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=M+VP87pE; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of hughd@google.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696044607; a=rsa-sha256; cv=none; b=R3J90DnCb0lBMt9y0vB7xCE5kGBSMSGTCsCVq1ME1xNqccciwgOZA70sI3aBD0nzDee/3N Q/VbTbFqPIF2y/x1g3r+vM5HivkqeZo4Fx2krAUrgaFm2tQebRBf/jpKWwS3MXKamV4MPw NmfVAI/0pH+M88tCw/aFEG2DzyPCa74= Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-41811e7ac3dso62138401cf.2 for ; Fri, 29 Sep 2023 20:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696044606; x=1696649406; darn=kvack.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=F5lBL1dIqosEB13vnHNJcMu3nNFm9z6wAJ0sm8x1c/Y=; b=M+VP87pEJlZ1a+ZaNZ2BZVasBSvNNCg5oB2e1M52ZcjZUUiSB5ywVRtWeLsuA1Gw+q 692c3yUvXV0S7gGyDMTu/mdxhrclpTe/Ab/Se8UCMLHI9IhdpEI0rVTHx+H5zhULpucn 1zD6HxV/qiDeaBRj3uL6vY5QQNoj5Ga9ASwyjfuOeA9i0Hj2Hy7//g9BffXcO8dEWkyj Q5ZH84EWKsPCQvKbBdByT33Mrz202XqvdhZQzx3B6g/dhqtdMZfNUnqYCvy0vHlH3sST 5seXf98WgroC3WUxzPEXFbGmwc0Ku7/8JZp9dmOS7unX2TgfXwzFBtnRS4jpNqX8HBfW dubg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696044606; x=1696649406; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F5lBL1dIqosEB13vnHNJcMu3nNFm9z6wAJ0sm8x1c/Y=; b=ib6Cvr9TueQQRiAexL/ZfINdmGIk1PtijAvgdx7WRxTGkAOmFNQD/y0dg8D0q+jpEP de0eKN7uENr1yqbUvPD7r3v/7cUobhzlulZ9d80BcnxAH5RaFiNY+JdILP5LT2KsYmXr ubpENYAvGoZCUIICKHBEWb8sSZwz/rsyIXOFskLrZeF4ZlgPoeotobpp7Fg9uNvo+sJ2 5d3G6RQ2D6CCDyGcbqoX971+1LJVVQTBx56z5PMmd+sBVD8fEpIYyqVkiveFhpzfZ+R8 6QNiduJNzB1BvIQO9i/YmAEDI0sDH9BR5YzdAcDAdTDmRJ4DDDmCFlSjztaVYmTjNjlI n5GA== X-Gm-Message-State: AOJu0YxVfHE7WHFRpG581HTMtzelwo3u7t5RMYMUP8FO6xrAakZq5i7i 3rW4VucR1VFY1wdZ+5TxFHXTWQ== X-Google-Smtp-Source: AGHT+IGP2fxP6CWffX9Qi9wXG2I3wbOa1qZMTS36GprFKCZ9FBnqMrcBGIljlzMe7rrEDbitBUPjPw== X-Received: by 2002:a05:622a:5cb:b0:412:c2a:eaef with SMTP id d11-20020a05622a05cb00b004120c2aeaefmr6834494qtb.11.1696044606428; Fri, 29 Sep 2023 20:30:06 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id r74-20020a0de84d000000b0059bc980b1eesm5981929ywe.6.2023.09.29.20.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 20:30:05 -0700 (PDT) Date: Fri, 29 Sep 2023 20:30:03 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Christian Brauner , Carlos Maiolino , Chuck Lever , Jan Kara , Matthew Wilcox , Johannes Weiner , Axel Rasmussen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 5/8] shmem: shmem_acct_blocks() and shmem_inode_acct_blocks() In-Reply-To: Message-ID: <9124094-e4ab-8be7-ef80-9a87bdc2e4fc@google.com> References: MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7C71F1A0008 X-Stat-Signature: nfi1dgjkjy51xoaxpafybcxakdsagxy5 X-Rspam-User: X-HE-Tag: 1696044607-308855 X-HE-Meta: U2FsdGVkX1+ciPeDRB3mF5buByk0HhCoWyfKsKaZF34PzxH/8EveF3BIXYVqt1pHH7dw0VovnYsfGZpIoPejHJKw1aEHwaXo9jnXQkSKFI00jcpcFAQmkceOJk6L3Nkg4zfnSPiqW2cMyrErXf0/fJnqOsANp+Dmq9h2Rt99No/Qjs4C/UUdGuG/UyYpAdoFxljBZEJAIBTTZVi9BmFN0L8kXPaiNmB8etAHAvDlsRJbh3H9M6GRYNs8S5vF8jexLaWv3ykwD2OkWgkhoj/A/l39e5mTQtuVrN2NC6R6iNusFAa4GI+o7NAz4bfzF/HB05EJWTK7n2kN5aLog8FjoJF+iArVPE+zYGhwx5unaLMlMB7h4Fba3UNGhCWOjsK96eEw2bdmt3db+bwzrFcfgJqKke54tM1LDD/hZooknobRI2XSnniScV7H3LUq4+GV/lCBARV5b7bK3B+uWcz5Se5xu7bUa7HICOOqhWyvSC5aoaig/LNd+TEBywV3nEPl/5+8C3zj0E4DQViuXSyU0+8IIX/VbQjNASLOUWeMxQ5qtjfpSrjroCZhHlXtJY4GF0kJzSlK7limFJkOW8ETXfodjE8FvsiAaymM+jxhJLeJhGVF/BTwn1MTtwWux/mIt9Xl48sz1dyNDc0scsTix0A44ejoiKc1eb/LJFBi7aEea22t2e9iSf580WEinpEfalil9MNzTbpxAHkvSOYpUmNBnBiI11B8/70FzoW7fRlWwYFkowlt39+Bw75r5q8JZZ6B/7q0Z3RtoOzGed6RhmzcEQ2Zgo6Bqsazh0VsOC0ckGIjR8/GFRK7Djiej7aka2QxPBn2bVQxKOg1wiYdNh4eTTLuUHKxNCx13RSPfNDCKCWYrj5GuBbEGMlh6MyOy9ehLu3p4+6akSzitRyH5xOg5GRoND2QTD6oX8y7XXAtg6FPJmVHmXuMadG3gV81nukmof84MN0S32ggIBs BF1hdPUD yy5L1Xj2oZ8lqOxakOq9mnlc1lpkT/O1pHLkDVBlh5C4rC81IEyVQt1yJ8od4syIY2XsDouw/Amm0VHzMSpaMEGeHlt2e2qwC/KeekjhJ71CDE8rKWPLlvVuPU8RdiFPZyO+FqrSDX/y4RYTYE7xtS0+hxVwKxfeEmUfgn+EIZLe+x83f5fiJBEtM+LxL24Vn5QDi7YlPFOxpe3mKNouAa+x6A3NJeiMLAZoRboTD1REbzN9o0rbhXS43l6FrTWbOgacZKvVnOw8Xsfo+KQ08Lk90b58LJUuvp4APtnLvf4roqI8vT4alujkEbwfA8acLqvGmWiAS+7CsXb9fcyMQ/LsnjzDhfPkIdxUPL4J5V3yBhTlcwc56dZ6+cndfy+YJgpQg2vHlzfJDvrhrZr1nMWsFH9RnQb1bnY33xw5G5QbNGns= 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: By historical accident, shmem_acct_block() and shmem_inode_acct_block() were never pluralized when the pages argument was added, despite their complements being shmem_unacct_blocks() and shmem_inode_unacct_blocks() all along. It has been an irritation: fix their naming at last. Signed-off-by: Hugh Dickins Reviewed-by: Jan Kara --- mm/shmem.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index caee8ba841f7..63ba6037b23a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -189,10 +189,10 @@ static inline int shmem_reacct_size(unsigned long flags, /* * ... whereas tmpfs objects are accounted incrementally as * pages are allocated, in order to allow large sparse files. - * shmem_get_folio reports shmem_acct_block failure as -ENOSPC not -ENOMEM, + * shmem_get_folio reports shmem_acct_blocks failure as -ENOSPC not -ENOMEM, * so that a failure on a sparse tmpfs mapping will give SIGBUS not OOM. */ -static inline int shmem_acct_block(unsigned long flags, long pages) +static inline int shmem_acct_blocks(unsigned long flags, long pages) { if (!(flags & VM_NORESERVE)) return 0; @@ -207,13 +207,13 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages) vm_unacct_memory(pages * VM_ACCT(PAGE_SIZE)); } -static int shmem_inode_acct_block(struct inode *inode, long pages) +static int shmem_inode_acct_blocks(struct inode *inode, long pages) { struct shmem_inode_info *info = SHMEM_I(inode); struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); int err = -ENOSPC; - if (shmem_acct_block(info->flags, pages)) + if (shmem_acct_blocks(info->flags, pages)) return err; might_sleep(); /* when quotas */ @@ -447,7 +447,7 @@ bool shmem_charge(struct inode *inode, long pages) { struct address_space *mapping = inode->i_mapping; - if (shmem_inode_acct_block(inode, pages)) + if (shmem_inode_acct_blocks(inode, pages)) return false; /* nrpages adjustment first, then shmem_recalc_inode() when balanced */ @@ -1671,7 +1671,7 @@ static struct folio *shmem_alloc_and_acct_folio(gfp_t gfp, struct inode *inode, huge = false; nr = huge ? HPAGE_PMD_NR : 1; - err = shmem_inode_acct_block(inode, nr); + err = shmem_inode_acct_blocks(inode, nr); if (err) goto failed; @@ -2572,7 +2572,7 @@ int shmem_mfill_atomic_pte(pmd_t *dst_pmd, int ret; pgoff_t max_off; - if (shmem_inode_acct_block(inode, 1)) { + if (shmem_inode_acct_blocks(inode, 1)) { /* * We may have got a page, returned -ENOENT triggering a retry, * and now we find ourselves with -ENOMEM. Release the page, to