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 55A9E379C2A for ; Thu, 30 Jul 2026 11:53:23 +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=1785412404; cv=none; b=lXw38zBvAzgY0T0sLPFjdBuE4C09f56AKBA1yrddoYWvIw6nawr1wqSYMjU5XUC/0Cv+UD0FGjdu/faaAK7uqJXp2xzZY8/wpWiH7gVGfWnZBMdOHmwXbmW6hWVfNbowTBO7vw8qA0gXN++zRyfkHp7UziqnS9qyp/utY+TZBco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785412404; c=relaxed/simple; bh=AxBK9meltTnlNXFUJ2ElMTcZz6OHNoZNtAT6SWj/SFk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=XowSDvy4HOGMORNhvYLLqcVnncBC7Ok6XQxcC/xV3dYAudox/wS7fVrsLefMk9+BfuBDWi7Opup99cGfuQLAfmYJMCwHs7GlPQ2Wl9QykdvOc6KcaQtAnuk4HzQNF4LZSbQmRroGlKWm35oQA/qdwiTwIGL1t9+YFVIenSGaJgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Tcq/3Rns; 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="Tcq/3Rns" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A601F000E9; Thu, 30 Jul 2026 11:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785412403; bh=RI2GUexLmVv8gB7H4ZANPJBiidvoccuLoXhfaCBsWjs=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=Tcq/3Rns1MAd8B1/L7Wt94PX9kJJUcT4EbttzTvK6Xl4qi9iy5hsl+eRMHNOV3hyi /Mk3gix0qtRSRs/M1JUAkS7jHYamRkTtD5ZpR+TcB414J/21Bwz71T3It8uHKHCFkH QW0ZDT3X+9Qk+L70kqoIbLrxuzWrcnNyHtLchES3uGmkDtv4eGB5kmHhcwTUkrohoq Rj0z5pYeVOfsbvzeOsEFaFU/StIg8eEmEJgRLNxUObJaaDwsS88WYePIxYM8/2+weG ylkVcgYkRtbkOoWdIy2v20zBKgRNt04rKm57oUuBTg0pIgXPagEFhf2TLzV6LeKE1R dT2OrncI5cJSA== From: Pratyush Yadav To: Mike Rapoport Cc: Pratyush Yadav , 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 v5 17/22] mm/mm_init: don't rely on memblock to get KHO scratch migratetype In-Reply-To: (Mike Rapoport's message of "Thu, 30 Jul 2026 10:23:44 +0300") References: <20260729145610.2827231-1-pratyush@kernel.org> <20260729145610.2827231-18-pratyush@kernel.org> Date: Thu, 30 Jul 2026 13:53:19 +0200 Message-ID: <2vxzik5w7ky8.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 Thu, Jul 30 2026, Mike Rapoport wrote: > On Wed, Jul 29, 2026 at 04:56:02PM +0200, Pratyush Yadav wrote: >> From: "Pratyush Yadav (Google)" >> >> Currently struct page init via memmap_init() or deferred_init_memmap() >> only queries the migrate type from KHO for each discrete memory range. >> That works currently since KHO scratch memory has a different memory >> type so it is always it its own region. >> >> An upcoming patch will add support for discovering blocks of memory with >> no preservations and it will mark it as MEMBLOCK_KHO_SCRATCH to allow >> allocations from them. This can lead to the bootmem KHO scratch areas to >> be merged into larger free ranges. This merging breaks the selection of >> migrate type. >> >> Get rid of memblock_is_kho_scratch_memory(). Instead, use >> kho_scratch_overlap() to decide the migrate type of the PFN. Since >> kho_scratch_migratetype() only uses KHO functions, move it to >> kexec_handover.h. >> >> Instead of calling kho_scratch_migratetype() once for each free range, >> call it once for each pageblock. Update >> pageblock_migratetype_init_range() and memmap_init_range() to do so. >> >> Since the migrate type is now evaluated for each pageblock and not each >> free range, drop the migratetype arguments to deferred_free_pages() and >> memmap_init_zone_range() and use MIGRATE_MOVABLE directly. >> >> Signed-off-by: Pratyush Yadav (Google) >> --- >> include/linux/kexec_handover.h | 15 +++++++++++++++ >> include/linux/memblock.h | 19 ------------------- >> mm/memblock.c | 10 ---------- >> mm/mm_init.c | 27 +++++++++++++-------------- >> 4 files changed, 28 insertions(+), 43 deletions(-) >> >> diff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h >> index 18ba417f1ada..c83ec4a15fe7 100644 >> --- a/include/linux/kexec_handover.h >> +++ b/include/linux/kexec_handover.h >> @@ -5,6 +5,7 @@ >> #include >> #include >> #include >> +#include > > Should have been mm.h, kbuild bot is unhappy otherwise :) > > https://lore.kernel.org/all/202607301001.ARjK0D4v-lkp@intel.com > > I can fix it while applying. I pulled this in for definition of enum migratetype. But I forgot about pageblock_order. I plan to do a v6 with the lockdep and documentation fixes anyway, so will fix that in v6. -- Regards, Pratyush Yadav