From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 074EF3C199B for ; Mon, 15 Jun 2026 08:45:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781513135; cv=none; b=DPoXTXVJvh8XKkaHj3lxmtZk4j8W0VWben5VozLNvnLyCFNawkPyqqmfSjodHNpTcYWB9mYDIdvVtuqUURjVU+CMVotzBDPdqb01J60JdNYKPooS8GPaaHOCRTsBznaA+v8gcDNK5N+XH+lqNr58SvM3ZkkQEGGB0xNkFYp74M8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781513135; c=relaxed/simple; bh=9Jm4k2i1ci/THg4OcVgCv1Y10n2g7/5+J2F//tf0Ado=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=rAdMba9eaUrrodNK9qF9aWyn5TH547zlhE0/fbasE6kXFT6AMDxfR3fZ7c7zhNg5aoW8ln0yRJ95fJ5OcnfyDRZdhvw8C4Ol2NDkKm90S0vunqcKwlrZHI7L6UlWl0BBlExTgYB/lI+BNLGe7ZFYtHkLKguNE9OGlW8vP+if5qA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Hkljb8J7; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Hkljb8J7" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781513129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Jm4k2i1ci/THg4OcVgCv1Y10n2g7/5+J2F//tf0Ado=; b=Hkljb8J7pCiLEUhyQY16gBNRETl0vYvjfj/swktUmFSzMKg8I0fR4+bIC8enNuSbBnZfwh 3R9UTd1e1xfylTPm/Fiy7Z8JsbGEdq6aGH5xaAPjMyB5kXAIDU8vK5fGefV27Fhm2M7tbv MX/zl2wkZoqzXvOYThktd19dkbVpSzo= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [PATCH v3 14/19] mm/hugetlb: Free cross-zone bootmem gigantic pages after allocation X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: Date: Mon, 15 Jun 2026 16:44:48 +0800 Cc: Muchun Song , Oscar Salvador , David Hildenbrand , Andrew Morton , Madhavan Srinivasan , Michael Ellerman , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nicholas Piggin , "Christophe Leroy (CS GROUP)" , "Ritesh Harjani (IBM)" , "Aneesh Kumar K.V" , linuxppc-dev@lists.ozlabs.org Content-Transfer-Encoding: quoted-printable Message-Id: <386B96EF-7EBB-44C0-8B83-D4BB8B60D649@linux.dev> References: <20260602101039.1867613-1-songmuchun@bytedance.com> <20260602101039.1867613-15-songmuchun@bytedance.com> <178041489395.457517.12727427621570734471.b4-review@b4> <1ABCD934-CA2C-4541-9B76-32FAEFD398FF@linux.dev> To: Mike Rapoport X-Migadu-Flow: FLOW_OUT > On Jun 14, 2026, at 17:55, Mike Rapoport wrote: >=20 > On Wed, Jun 03, 2026 at 10:53:04AM +0800, Muchun Song wrote: >>> On Tue, 02 Jun 2026 18:10:34 +0800, Muchun Song = wrote: >>>>=20 >>>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >>>> index 5e557c05d80a..218fb1ca45f4 100644 >>>> --- a/mm/hugetlb.c >>>> +++ b/mm/hugetlb.c >>>> @@ -3073,22 +3076,38 @@ static bool __init = alloc_bootmem_huge_page(struct hstate *h, int nid) >>>> [ ... skip 26 lines ... ] >>>> + * pages belonging to the requested node. >>>> + */ >>>> + if (WARN_ON_ONCE(nid_request !=3D NUMA_NO_NODE && nid !=3D = nid_request)) >>>> + list_add(&m->list, &huge_boot_pages[nid_request]); >>>> + else >>>> + list_add(&m->list, &huge_boot_pages[nid]); >>>=20 >>> Can we just memblock_free() the page that intersects zones here? >>=20 >> I had previously considered doing this, but then I realized that if = we free the >> allocated cross-zone memory here, memblock is very likely to select = the exact >> same block for the next allocation. This means we'd just end up with = this >> cross-zone memory again, degrading allocation efficiency. Unless = there is a way >> to mark the block so memblock avoids reallocating it, I ultimately = chose to >> defer the release to prevent this issue from happening. >=20 > You are right, there's no simple way to avoid memblock using the same > range. >=20 > The comment at hugetlb_hstate_alloc_pages() hints that we might want = to > split allocation of gigantic pages to be more explicit as a followup > rework and then freeing of cross-zone pages would be cleaner as well. Make sense. A followup rework is better. Thanks. >=20 >> Thanks. >=20 > --=20 > Sincerely yours, > Mike.