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 Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux