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: <ZaktH7xc72x4Xr3d@casper.infradead.org>
Date: Thu, 18 Jan 2024 13:52:31 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Chris Li <chrisl@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Wei Xu <weixugc@...gle.com>,
	Yu Zhao <yuzhao@...gle.com>, Greg Thelen <gthelen@...gle.com>,
	Chun-Tse Shao <ctshao@...gle.com>,
	Suren Baghdasaryan <surenb@...gle.com>,
	Brain Geffon <bgeffon@...gle.com>, Minchan Kim <minchan@...nel.org>,
	Michal Hocko <mhocko@...e.com>,
	Mel Gorman <mgorman@...hsingularity.net>,
	Huang Ying <ying.huang@...el.com>, Nhat Pham <nphamcs@...il.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Kairui Song <kasong@...cent.com>,
	Zhongkun He <hezhongkun.hzk@...edance.com>,
	Kemeng Shi <shikemeng@...weicloud.com>,
	Barry Song <v-songbaohua@...o.com>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Joel Fernandes <joel@...lfernandes.org>,
	Chengming Zhou <zhouchengming@...edance.com>
Subject: Re: [PATCH 1/2] mm: zswap.c: add xarray tree to zswap

On Wed, Jan 17, 2024 at 10:20:29PM -0800, Yosry Ahmed wrote:
> >         /* walk the tree and free everything */
> >         spin_lock(&tree->lock);
> > +
> > +       xas_for_each(&xas, e, ULONG_MAX)
> 
> Why not use xa_for_each?

xas_for_each() is O(n) while xa_for_each() is O(n log n), as mentioned
in the fine documentation.  If you don't need to drop the lock while
in the body of the loop, always prefer xas_for_each().


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ