From nobody Sun Feb 8 18:44:45 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.4]) (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 D2535318EDE for ; Wed, 21 Jan 2026 14:36:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006194; cv=none; b=ef7AR5/l0OcoPSnRVb8Pps3sUFwvWezcevrDH9t3UZP4ICBQM2Mnzoq9IeG+78se1396tV5A2/gQXJ5bTjt/aR0E3q0xaPRl+gKS2Aj1xLwPhF38PVlfhIjcftyNTaTxXwPvXJ2NcCCS9LfeIAE4ivJ0lSly4SHbyeEhTwnCl8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769006194; c=relaxed/simple; bh=1FFolPv6bR4KSb+X/vfELNlR1bAGxOLPb31KONmkM4Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Aj//QuqbpiToG2sGbzDfs2E89xpyB1AleL+rIAQVob/KlSCd21wiAcElpZjmRwBv2RgnEKm5Y/Kj71oXn77juIFK/s4b/FdwtBJ64uZxNuH1YrnUuTSO5R9MjBmauS7PvLfBw0OF4zcbIURPEId0n2YhXXQWeouWR1zOf8iGci0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=H11EW6za; arc=none smtp.client-ip=117.135.210.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="H11EW6za" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=w/ WDHKSYXm8Fddt+PSh+C072ZZ2mR98/5mghWuOHgEc=; b=H11EW6zabDu1SOki7q DfOJPT+8F8W1lFgEMzRSRCSDRiA3xmPo9TLo2eko2FxeV7lHoWoKSp28ZMxGletz +ux56OGnr8BVOcIPtgYpn/mhAUOArjE5TDpgKRhg8QHAeXXV3NzMPZ5fpLWoK60x duqIyhzT4ikaLYVm9w7GdCgK0= Received: from ubuntu24-z.. (unknown []) by gzsmtp5 (Coremail) with SMTP id QCgvCgA3oF_443Bpg3L7MA--.289S2; Wed, 21 Jan 2026 22:34:35 +0800 (CST) From: ranxiaokai627@163.com To: pratyush@kernel.org, surenb@google.com, akpm@linux-foundation.org Cc: pasha.tatashin@soleen.com, kent.overstreet@linux.dev, rppt@kernel.org, graf@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, ran.xiaokai@zte.com.cn, ranxiaokai627@163.com Subject: [PATCH v3] kho: init alloc tags when restoring pages from reserved memory Date: Wed, 21 Jan 2026 14:34:30 +0000 Message-ID: <20260121143430.175294-1-ranxiaokai627@163.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: QCgvCgA3oF_443Bpg3L7MA--.289S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ArWkWr1xuFWrXFyruw4xXrb_yoW8KFyfpr W8tw1ktayrJan8Za17ta1q934ftws5JayrJay7u34fXFnxA3Z2yas7Xa4jvFy5Gry8XF4x Ww4UJrZ0v3Z09aDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0piFdgJUUUUU= X-CM-SenderInfo: xudq5x5drntxqwsxqiywtou0bp/xtbCxRyu+mlw4-xfYwAA33 Content-Type: text/plain; charset="utf-8" From: Ran Xiaokai Memblock pages (including reserved memory) should have their allocation tags initialized to CODETAG_EMPTY via clear_page_tag_ref() before being released to the page allocator. When kho restores pages through kho_restore_page(), missing this call causes mismatched allocation/deallocation tracking and below warning message: alloc_tag was not set WARNING: include/linux/alloc_tag.h:164 at ___free_pages+0xb8/0x260, CPU#1: = swapper/0/1 RIP: 0010:___free_pages+0xb8/0x260 kho_restore_vmalloc+0x187/0x2e0 kho_test_init+0x3c4/0xa30 do_one_initcall+0x62/0x2b0 kernel_init_freeable+0x25b/0x480 kernel_init+0x1a/0x1c0 ret_from_fork+0x2d1/0x360 Add missing clear_page_tag_ref() annotation in kho_restore_page() to fix this. Signed-off-by: Ran Xiaokai --- It is based on linux-next 20260120. I dont konw whether this base is ok ? kernel/liveupdate/kexec_handover.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index 43d9d2661163..8f7e09d67e1b 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -219,8 +219,11 @@ static int __kho_preserve_order(struct kho_mem_track *= track, unsigned long pfn, /* For physically contiguous 0-order pages. */ static void kho_init_pages(struct page *page, unsigned long nr_pages) { - for (unsigned long i =3D 0; i < nr_pages; i++) + for (unsigned long i =3D 0; i < nr_pages; i++) { set_page_count(page + i, 1); + /* Mark the codetag as empty to avoid accounting mismatch */ + clear_page_tag_ref(page + i); + } } =20 static void kho_init_folio(struct page *page, unsigned int order) @@ -236,6 +239,9 @@ static void kho_init_folio(struct page *page, unsigned = int order) =20 if (order > 0) prep_compound_page(page, order); + + /* Mark the codetag as empty to avoid accounting mismatch */ + clear_page_tag_ref(page); } =20 static struct page *kho_restore_page(phys_addr_t phys, bool is_folio) @@ -265,7 +271,6 @@ static struct page *kho_restore_page(phys_addr_t phys, = bool is_folio) else kho_init_pages(page, nr_pages); =20 - clear_page_tag_ref(page); adjust_managed_page_count(page, nr_pages); return page; } --=20 2.25.1