[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YK9YzS1T3xp3QI8/@infradead.org>
Date: Thu, 27 May 2021 09:31:09 +0100
From: Christoph Hellwig <hch@...radead.org>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: akpm@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 33/33] mm: Add folio_mapped
On Tue, May 11, 2021 at 10:47:35PM +0100, Matthew Wilcox (Oracle) wrote:
> This function is the equivalent of page_mapped(). It is slightly
> shorter as we do not need to handle the PageTail() case. Reimplement
> page_mapped() as a wrapper around folio_mapped().
No byte savings numbers as for the other patches?
The patch itself looks good, although I'd go for a slightly easier
readable structure:
bool folio_mapped(struct folio *folio)
{
if (folio_single(folio))
return atomic_read(&folio->_mapcount) >= 0;
if (atomic_read(compound_mapcount_ptr(&folio->page)) >= 0)
return true;
if (!folio_hugetlb(folio)) {
unsigned long i;
for (i = 0; i < folio_nr_pages(folio); i++)
if (atomic_read(&folio_page(folio, i)->_mapcount) >= 0)
return true;
}
return false;
}
Shouldn't we also have a folio version of compound_mapcount_ptr?
Powered by blists - more mailing lists