lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231003132131.j4mnrryyftbmzvtb@quack3>
Date:   Tue, 3 Oct 2023 15:21:31 +0200
From:   Jan Kara <jack@...e.cz>
To:     Hugh Dickins <hughd@...gle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Christian Brauner <brauner@...nel.org>,
        Carlos Maiolino <cem@...nel.org>,
        Chuck Lever <chuck.lever@...cle.com>, Jan Kara <jack@...e.cz>,
        Matthew Wilcox <willy@...radead.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org
Subject: Re: [PATCH 5/8] shmem: shmem_acct_blocks() and
 shmem_inode_acct_blocks()

On Fri 29-09-23 20:30:03, Hugh Dickins wrote:
> 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 <hughd@...gle.com>

OK. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  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
> -- 
> 2.35.3
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ