Re: [PATCH v10 33/33] mm: Add folio_mapped

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux