From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 DB2EC3859F3 for ; Mon, 15 Jun 2026 19:40:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781552408; cv=none; b=SwM/ldw+Q+x07qetIR7Wy4Lxeq5AbTIA8zjxwXEHF/apExBSF5pCa3K6GuY4xRhoO9t/20LC86dCk49A2HKJgMHg7CfwcV9ucwwMWLJZ9PdGRFc0YQN7iGRZhxoIRRwznndj4xAl3mPybVR46YEfkc/kfWbg0SAGc0eSS86BSW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781552408; c=relaxed/simple; bh=8eQDCbU4WdFN23zckArZGlHnn8ya9MMgiyRALNgwfaE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FQIZIg465MIul6UDZBglPM9E/Eo4vM9Y+SzpBpeo8/3uQ4PQYdswe1zN6DVEmLxGR1xRt9X+brvN54zBy/Zzb2/Ni4TLEOwhupgElxcONVFan7bj1kye72k61ANpyOGwhg2ONAI8Pn3qW2pA83XMXl7Tmi98UvF1uRO+HoqjHdk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WKQue0AH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WKQue0AH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01C251F000E9; Mon, 15 Jun 2026 19:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781552407; bh=h7B8DczUlZvoXStP+g9L9ex1t6hea3WLt+N+VMfAkwQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=WKQue0AH0htjX4UnzX+Hx1GmH8vKLOTbqpeJ7AM4DBR/0gN8Lz3FXAQtOwe0fysZY +6C81/uwDS4zGXp7VX5qIkE8+MraetDUvRtVpm5Wz3LiSS7TXWi6GH3fhFrNlFI5UN 4I7339GVUqdaNYa/SMZ9Hg1K+aB8gXDwIgPG4AYl/1GS2xwkXnmDLC9ZSbkWTMWLvb snXbil0WlO5o6bCGeqAkOAMKayAT+77FzegUGxIekv+Ho6iASyP9CXNnnrS1bdiV+/ 7Pb2XnLtIB1fo3koDUQ9pd+XgQwqi5VnPipybsMlwvUov2Y5uBd7mppz9OI/Y2ZgIz pEC8BIWKh32bw== Date: Mon, 15 Jun 2026 22:40:00 +0300 From: Mike Rapoport To: Pratyush Yadav Cc: Pasha Tatashin , Alexander Graf , Muchun Song , Oscar Salvador , David Hildenbrand , Andrew Morton , Jason Miu , Jork Loeser , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 16/18] memblock: make HugeTLB bootmem allocation work with KHO Message-ID: References: <20260605183501.3884950-1-pratyush@kernel.org> <20260605183501.3884950-17-pratyush@kernel.org> <178143855120.2123877.5431342391381982046.b4-review@b4> <2vxzpl1soris.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2vxzpl1soris.fsf@kernel.org> On Mon, Jun 15, 2026 at 03:35:39PM +0200, Pratyush Yadav wrote: > On Sun, Jun 14 2026, Mike Rapoport wrote: > > On Fri, 05 Jun 2026 20:34:49 +0200, Pratyush Yadav wrote: > > > >> First, it does not use mirrored memory for hugetlb. Mirrored memory is a > >> limited resource that is best saved for kernel data structures, not user > >> memory. > >> > >> Second, if the memory found overlaps with KHO scratch areas, it discards > >> the memory and retries. > > > > This sentence is somewhat hard to parse. > > Okay, let me retry: > > Second, if the free memory area found by memblock_find_in_range_node() > is a part of a KHO scratch area, the free area is not used. Allocation > is retried starting after the free area to ensure no hugepages come from > KHO scratch. > > Any better? Yep :) > > > >> > >> > >> diff --git a/mm/memblock.c b/mm/memblock.c > >> index 6349c48154f4..131e54dd5d8d 100644 > >> --- a/mm/memblock.c > >> +++ b/mm/memblock.c > >> @@ -1756,6 +1761,69 @@ void * __init memblock_alloc_try_nid_raw( > >> [ ... skip 51 lines ... ] > >> + if (memblock_bottom_up()) > >> + start = addr + size; > >> + else > >> + start = addr - size; > >> + > >> + goto retry; > > > > Hmm, two goto retry don't seem nice :/ > > Although I can't see how to imporove it really. > > Dunno, looked easy enough to understand to me. > > > > Maybe add a helper for going the node fallback? > > There is a small downside. There will then be no way to know the > fallback was tried already, so if a retry is done because of scratch > overlap, the fallback needs to be done again. > > I don't think it should be too bad, so if you still prefer this then I > can do it. Let's keep it for now, maybe will find something smarter later. > -- > Regards, > Pratyush Yadav -- Sincerely yours, Mike.