From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1D283016F2 for ; Mon, 5 Jan 2026 16:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767631323; cv=none; b=lbtO1tj1ffZwK8HrWKgqo/dUPcT3WjYpQaQUatif628nBASyhKquVMwl/tXT2BwpLiiGXWhVuFX8KkP0mrNYHHcN6HOQKZDtQXU2w+sad9WLpf1W7LOEk8QrMyUg9ri3LOKLnJW48llepzaloSN5Lol+nAsW9ahnahxzAoOqfNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767631323; c=relaxed/simple; bh=l7n/0+u014ySthBJwUft271+xXwZzAoxmVShZAsevOs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nmmLQgN3D/KDl/X0LN1TagrqXdzPp4hrxraw0M085dqViATfmRV5+YUQ8zkMPUfdx6YgnF6YDDuBe/mcaD5QevzOrIEqyFUS0zY4qfA/cXR1lueKcMbaEgFodp+BudlHzaWsucpE955neij8X7m9PJ9qqOn8Cg0Pq+Isl6OGEBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6360E339; Mon, 5 Jan 2026 08:41:54 -0800 (PST) Received: from [10.1.38.150] (XHFQ2J9959.cambridge.arm.com [10.1.38.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 65D193F6A8; Mon, 5 Jan 2026 08:41:59 -0800 (PST) Message-ID: Date: Mon, 5 Jan 2026 16:41:58 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 0/2] Free contiguous order-0 pages efficiently Content-Language: en-GB To: Zi Yan Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Uladzislau Rezki , "Vishal Moola (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kefeng Wang References: <20260105161741.3952456-1-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 05/01/2026 16:36, Zi Yan wrote: > On 5 Jan 2026, at 11:17, Ryan Roberts wrote: > >> Hi All, >> >> A recent change to vmalloc caused some performance benchmark regressions (see >> [1]). I'm attempting to fix that (and at the same time signficantly improve >> beyond the baseline) by freeing a contiguous set of order-0 pages as a batch. >> >> At the same time I observed that free_contig_range() was essentially doing the >> same thing as vfree() so I've fixed it there too. >> >> I think I've convinced myself that free_pages_prepare() per order-0 page >> followed by a single free_frozen_page_commit() or free_one_page() for the high >> order block is safe/correct, but would be good if a page_alloc expert can >> confirm! >> >> Applies against today's mm-unstable (344d3580dacd). All mm selftests run and >> pass. > > Kefeng has a series on using frozen pages for alloc_contig*() in mm-new > and touches free_contig_range() as well. You might want to rebase on top > of that. > > I like your approach of freeing multiple order-0 pages as a batch, since > they are essentially a non-compound high order page. I also pointed out > a similar optimization when reviewing Kefeng’s patchset[1] (see my comment > on __free_contig_frozen_range()). > > In terms of rebase, there should be minor for free_contig_range(). In addition, > maybe your free_prepared_contig_range() can replace __free_contig_frozen_range() > in Kefeng’s version to improve performance for both code paths. OK, great! I'll hold off on the rebase until I get some code review feedback on this version (I'd like to hear someone agree that what I'm doing is actually sound!). Assuming feedback is positive, I'll rebase v2 onto mm-new and look at the extra optimization opportunites as you suggest. Thanks, Ryan > > I will take a look at the patches. Thanks. > > [1] https://lore.kernel.org/linux-mm/D90F7769-F3A8-4234-A9CE-F97BC48CCACE@nvidia.com/ > >> >> Thanks, >> Ryan >> >> Ryan Roberts (2): >> mm/page_alloc: Optimize free_contig_range() >> vmalloc: Optimize vfree >> >> include/linux/gfp.h | 1 + >> mm/page_alloc.c | 116 +++++++++++++++++++++++++++++++++++++++----- >> mm/vmalloc.c | 29 +++++++---- >> 3 files changed, 125 insertions(+), 21 deletions(-) >> >> -- >> 2.43.0 > > > Best Regards, > Yan, Zi