Re: [PATCH v2 1/2] mm/memfd: refactor memfd_tag_pins() and memfd_wait_for_pins()

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

 



On Mon, Feb 26, 2024 at 03:13:23PM +0100, David Hildenbrand wrote:
> +	xas_for_each(xas, folio, ULONG_MAX) {
> +		if (!xa_is_value(folio) && memfd_folio_has_extra_refs(folio))
>  			xas_set_mark(xas, MEMFD_TAG_PINNED);

... we decline to tag value entries here ...

> @@ -95,20 +90,15 @@ static int memfd_wait_for_pins(struct address_space *mapping)
>  
>  		xas_set(&xas, 0);
>  		xas_lock_irq(&xas);
> -		xas_for_each_marked(&xas, page, ULONG_MAX, MEMFD_TAG_PINNED) {
> +		xas_for_each_marked(&xas, folio, ULONG_MAX, MEMFD_TAG_PINNED) {
>  			bool clear = true;
>  
> -			cache_count = 1;
> -			if (!xa_is_value(page) &&
> -			    PageTransHuge(page) && !PageHuge(page))
> -				cache_count = HPAGE_PMD_NR;
> -
> -			if (!xa_is_value(page) && cache_count !=
> -			    page_count(page) - total_mapcount(page)) {
> +			if (!xa_is_value(folio) &&
> +			    memfd_folio_has_extra_refs(folio)) {

... so we don't need to test it here because we'll never see any value
entries.  No?





[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