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: <6f2fc7279849e626f9150d0a14d544d1d641675e.camel@linux.intel.com>
Date: Fri, 14 Mar 2025 14:21:01 -0700
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Kemeng Shi <shikemeng@...weicloud.com>, akpm@...ux-foundation.org
Cc: kasong@...cent.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/9] mm: swap: use swap_entries_free() drop last 1 flag
 in swap_entries_put_nr()

On Fri, 2025-03-14 at 05:05 +0800, Kemeng Shi wrote:
> Use swap_entries_free() to drop last 1 flag to eliminate the need to set
> slot to the intermediate SWAP_HAS_CACHE state.
> 

Use swap_entries_free() to directly free swap entries when
the swap entries are not cached and referenced, without
needing to set swap entries to intermediate SWAP_HAS_CACHE state.
 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>

Reviewed-by: Tim Chen <tim.c.chen@...ux.intel.com>

> ---
>  mm/swapfile.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Use swap_entries_free() 
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 14b7b37996ff..0ce0ca08594e 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -1508,10 +1508,11 @@ static bool swap_entries_put_nr(struct swap_info_struct *si,
>  		unlock_cluster(ci);
>  		goto fallback;
>  	}
> -	for (i = 0; i < nr; i++)
> -		WRITE_ONCE(si->swap_map[offset + i], SWAP_HAS_CACHE);
>  	if (!has_cache)
>  		swap_entries_free(si, ci, entry, nr);
> +	else
> +		for (i = 0; i < nr; i++)
> +			WRITE_ONCE(si->swap_map[offset + i], SWAP_HAS_CACHE);
>  	unlock_cluster(ci);
>  
>  	return has_cache;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ