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: <8f757efce4efd600c2c49975f5ef8298c1ff5f4f.camel@linux.intel.com>
Date: Fri, 14 Mar 2025 14:34:18 -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 6/9] mm: swap: drop last SWAP_MAP_SHMEM flag in batch in
 swap_entries_put_nr()

On Fri, 2025-03-14 at 05:05 +0800, Kemeng Shi wrote:
> The SWAP_MAP_SHMEM indicates last map from shmem. Therefore we can drop
> SWAP_MAP_SHMEM in batch in similar way to drop last 1 flag in batch.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>

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

> ---
>  mm/swapfile.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 0ce0ca08594e..2d0f5d630211 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -192,7 +192,7 @@ static bool swap_is_last_map(struct swap_info_struct *si,
>  	unsigned char *map_end = map + nr_pages;
>  	unsigned char count = *map;
>  
> -	if (swap_count(count) != 1)
> +	if (swap_count(count) != 1 && swap_count(count) != SWAP_MAP_SHMEM)
>  		return false;
>  
>  	while (++map < map_end) {
> @@ -1497,7 +1497,10 @@ static bool swap_entries_put_nr(struct swap_info_struct *si,
>  	unsigned char count;
>  	int i;
>  
> -	if (nr <= 1 || swap_count(data_race(si->swap_map[offset])) != 1)
> +	if (nr <= 1)
> +		goto fallback;
> +	count = swap_count(data_race(si->swap_map[offset]));
> +	if (count != 1 && count != SWAP_MAP_SHMEM)
>  		goto fallback;
>  	/* cross into another cluster */
>  	if (nr > SWAPFILE_CLUSTER - offset % SWAPFILE_CLUSTER)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ