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 A9284233941 for ; Tue, 2 Jun 2026 13:35:47 +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=1780407348; cv=none; b=JTHvb4OuR+gnp4FH5n29QS6WjPTh+VMqBtJhg4QTwtXOku8nknZRGvHNH52PtFT1+Cbrjz86gWYCq479p4HDYThIWF0rrkngaun1JW5tBwAtAlReFKmAl+iKzRqdhAl7DsEWb5KOQ4uCpUFVIUIeWvE4craA8h2DkdS4qwXmGPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780407348; c=relaxed/simple; bh=KqZu73QCyc0S36BXLgduOWFZqLQ12gHHNi6nmSab5go=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=QZlaHJ1y39lU9L9AoXY9JhBe7zlIC+uj4wbZ+WW/tkwctpvdE1/DuQdLq0wVobcKGXow2MqcoL++GTeYpHPnpeImmpjXH9bJzzWuQa7geX3rlNnUoRHL0D9aya4ncjskCxF+Xj95dliXPt8gXgDgvtmrbyb6SU138FQJo/NvZNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nFQVeFrO; 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="nFQVeFrO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A25F01F00893; Tue, 2 Jun 2026 13:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780407347; bh=cIFsvZ8o1klM9coqPWB+8+5GuojIlmrjo3nZO0SjZgY=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=nFQVeFrO5qWsMa3rkGphURuuAJAkKJpVFsxhAS00xM2iY6Xa4CocSyrWIeK+pUzW7 9Df0aHNWngtOsJfkaqKnenGpysTrZa+Hp8sGt4qKTmPrKxkTwxdKM94fkhfZWEc0TZ Ks4iNkbGI5vIlAHXND8JluSSRXTaZvzl9muh85TqxIz+GhpKgLyBSBGCUSO6v+xgad lqqIrX6sS9hf5yOus/I4fOyWvH0kYnjk/5xxqsaEkwAR2KP7Y29uc+porWx7LMeReS N7l8mfCMZBxJf+HfOPjNFrawGaeCVtlru1mFpNxoa3116/fEVbQG+6p2/XIrpEQHnU nDuwvVpdeF/dg== From: Pratyush Yadav To: Mike Rapoport Cc: Pratyush Yadav , Pasha Tatashin , Alexander Graf , Muchun Song , Oscar Salvador , David Hildenbrand , Andrew Morton , Jason Miu , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 12/12] mm/hugetlb: make bootmem allocation work with KHO In-Reply-To: (Mike Rapoport's message of "Sun, 31 May 2026 21:40:07 +0300") References: <20260429133928.850721-1-pratyush@kernel.org> <20260429133928.850721-13-pratyush@kernel.org> <2vxzo6i37bs6.fsf@kernel.org> Date: Tue, 02 Jun 2026 15:35:44 +0200 Message-ID: <2vxzpl29dpzj.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Sun, May 31 2026, Mike Rapoport wrote: > On Mon, May 25, 2026 at 05:24:09PM +0200, Pratyush Yadav wrote: >> On Sun, May 17 2026, Mike Rapoport wrote: >> > On Wed, Apr 29, 2026 at 03:39:14PM +0200, Pratyush Yadav wrote: >> >> From: "Pratyush Yadav (Google)" >> >> So, in summary, I would like to pursue option 1 and try to make it more >> appetizing. But I would like to at least know if you hate the "extended >> scratch" (ignore the name) as a concept or only the code it results in. > > Let's retry this one :) > > I looked more closely, and it seems that mixing SCRATCH and SCRATCH_EXT > should be a lesser headache than going with option 4. I also had some time to ruminate on this. I still think option 1 has the most promise, but my opinion on option 4 has improved a bit. While I still am not sure adding a 3rd phase to struct page/MM init (early -> deferred -> KHO reserved blocks) is a good idea, I think it might not be as bad as I first thought. Dunno... Anyway, for now I think I will try to make option 1 more appetizing. Here's an idea I want to try out: I get rid of SCRATCH_EXT and mark the free blocks as SCRATCH. For HugeTLB, I can teach the special memblock_alloc_hugetlb_something() function to exclude scratch areas when looking for free memory ranges. So core memblock does not get a new memory type, and the complexity of hugepage allocation does not leak into memblock. How does that sound? > > Tracking the changes in gigantic pages in hugetlb also does not seem > something we'd like to pursue especially considering that memory from freed > or demoted gigantic pages could be reserved. > > If we add a dedicated memblock_something to allocate gigantic pages, we > can reduce branching in alloc_bootmem() to > > if (cma) > do_cma() > else > do_memblock() > > For hugetlb_cma we might want to teach CMA to create pre-allocated areas > and then it could reuse the same memblock API. This seems useful even > regardless of KHO. Sorry, I don't get what you mean by this. What pre-allocated areas? When creating CMA areas it calls cma_alloc_mem() which calls into memblock. What would we change about this? -- Regards, Pratyush Yadav