Re: [PATCH v1 2/3] mm: Implement folio_remove_rmap_range()

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

 



On Mon, Jul 17, 2023 at 04:49:19PM +0100, Ryan Roberts wrote:
> > We're still doing one atomic op per page on the folio's nr_pages_mapped
> > ... is it possible to batch this and use atomic_sub_return_relaxed()?
> 
> Good spot, something like this:
> 
> 	} else {
> 		for (; nr != 0; nr--, page++) {
> 			/* Is this the page's last map to be removed? */
> 			last = atomic_add_negative(-1, &page->_mapcount);
> 			if (last)
> 				nr_unmapped++;
> 		}
> 
> 		/* Pages still mapped if folio mapped entirely */
> 		nr_mapped = atomic_sub_return_relaxed(nr_unmapped, mapped);
> 		if (nr_mapped >= COMPOUND_MAPPED)
> 			nr_unmapped = 0;
> 	}

I think that's right, but my eyes always go slightly crossed trying to
read the new mapcount scheme.




[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