lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 26 Mar 2024 08:34:42 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...hsingularity.net>, Zi Yan <ziy@...dia.com>,
	"Huang, Ying" <ying.huang@...el.com>,
	David Hildenbrand <david@...hat.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 06/10] mm: page_alloc: fix freelist movement during block
 conversion

On Tue, Mar 26, 2024 at 12:28:37PM +0100, Vlastimil Babka wrote:
> On 3/20/24 7:02 PM, Johannes Weiner wrote:
> > Currently, page block type conversion during fallbacks, atomic
> > reservations and isolation can strand various amounts of free pages on
> > incorrect freelists.
> > 
> > For example, fallback stealing moves free pages in the block to the
> > new type's freelists, but then may not actually claim the block for
> > that type if there aren't enough compatible pages already allocated.
> > 
> > In all cases, free page moving might fail if the block straddles more
> > than one zone, in which case no free pages are moved at all, but the
> > block type is changed anyway.
> > 
> > This is detrimental to type hygiene on the freelists. It encourages
> > incompatible page mixing down the line (ask for one type, get another)
> > and thus contributes to long-term fragmentation.
> > 
> > Split the process into a proper transaction: check first if conversion
> > will happen, then try to move the free pages, and only if that was
> > successful convert the block to the new type.
> > 
> > Tested-by: "Huang, Ying" <ying.huang@...el.com>
> > Signed-off-by: Johannes Weiner <hannes@...xchg.org>
> 
> Reviewed-by: Vlastimil Babka <vbabka@...e.cz>

Thanks!

> >  	/* Take ownership for orders >= pageblock_order */
> >  	if (current_order >= pageblock_order) {
> > +		del_page_from_free_list(page, zone, current_order);
> >  		change_pageblock_range(page, current_order, start_type);
> > -		goto single_page;
> > +		expand(zone, page, order, current_order, start_type);
> > +		return page;
> 
> Is the exact order here important (AFAIK shouldn't be?) or we could just
> change_pageblock_range(); block_type = start_type; goto single_page?

At the end of the series, the delete function will do the
(type-sensitive) accounting and have a sanity check on the mt. So we
have to remove the page from the list before updating the type.

We *could* do it in this patch and revert it again 4 patches later,
but that's likely not worth the hassle to temporarily save one line.

> >  single_page:
> > -	move_to_free_list(page, zone, current_order, start_type);
> > +	del_page_from_free_list(page, zone, current_order);
> > +	expand(zone, page, order, current_order, block_type);
> > +	return page;
> >  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ