[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240812144311.GA29114@lst.de>
Date: Mon, 12 Aug 2024 16:43:11 +0200
From: Christoph Hellwig <hch@....de>
To: Matthew Wilcox <willy@...radead.org>
Cc: Christoph Hellwig <hch@....de>,
Chandan Babu R <chandan.babu@...cle.com>,
"Darrick J. Wong" <djwong@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 2/3] xfs: convert perag lookup to xarray
On Mon, Aug 12, 2024 at 03:39:33PM +0100, Matthew Wilcox wrote:
> > + rcu_read_lock();
> > + xa_for_each_marked(&mp->m_perags, index, pag, XFS_ICI_RECLAIM_TAG) {
> > + trace_xfs_reclaim_inodes_count(pag, _THIS_IP_);
> > reclaimable += pag->pag_ici_reclaimable;
> > - xfs_perag_put(pag);
> > }
> > + rcu_read_unlock();
>
> Would you rather use xas_for_each_marked() here? O(n) rather than
> O(n.log(n)).
>
> Other than that, looks like a straightforward and correct conversion.
That probably would be more efficient, but the API feels like awkward
due to the required end argument on top of the slightly cumbersome
but not really horrible caller provided XA_STATE().
Is there any good reason why there's isn't an O(1) version that is
just as simple to use as xa_for_each_marked?
Powered by blists - more mailing lists