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: <20230605154405.GC221380@cmpxchg.org>
Date:   Mon, 5 Jun 2023 11:44:05 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     Domenico Cerasuolo <cerasuolodomenico@...il.com>
Cc:     vitaly.wool@...sulko.com, minchan@...nel.org,
        senozhatsky@...omium.org, yosryahmed@...gle.com,
        linux-mm@...ck.org, ddstreet@...e.org, sjenning@...hat.com,
        nphamcs@...il.com, akpm@...ux-foundation.org,
        linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [RFC PATCH 6/7] mm: zswap: simplify writeback function

On Mon, Jun 05, 2023 at 10:54:18AM +0200, Domenico Cerasuolo wrote:
> @@ -1142,9 +1122,6 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
>  	zswap_written_back_pages++;
>  
>  	spin_lock(&tree->lock);
> -	/* drop local reference */
> -	zswap_entry_put(tree, entry);
> -
>  	/*
>  	* There are two possible situations for entry here:
>  	* (1) refcount is 1(normal case),  entry is valid and on the tree
> @@ -1152,7 +1129,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
>  	*     because invalidate happened during writeback
>  	*  search the tree and free the entry if find entry
>  	*/
> -	if (entry == zswap_rb_search(&tree->rbroot, offset))
> +	if (entry == zswap_rb_search(&tree->rbroot, swp_offset(swpentry)))
>  		zswap_entry_put(tree, entry);
>  	spin_unlock(&tree->lock);

This can be moved to zswap_shrink() as well. It already has a
post-writeback tree->lock section for lru putback and dropping its
local reference, it should do this as well.

Writeback is then is done after it bumped zswap_written_pages.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ