From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-191.mta0.migadu.com [91.218.175.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4603A48A8CC for ; Mon, 12 Oct 2026 12:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791809757; cv=none; b=gx1BUQu8vrAFPzbh+lnZvSaE0jx85EouiwNgrlgQ1yfokPFvRsa4EDhfYGDuNRu0KFm1q4xRvW/JXdfHVqkDplVFb/u464yPe/pfyK1zXQ4nNuJLZM5PjMeRRA41jL3duxoi4eFeaxWvGgua8dYfNPhomXdYMetdEodL/NEY8Qo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791809757; c=relaxed/simple; bh=zVdDm9vWio9URlOBbk5H1FhupUhm6ZtZOBzYo8Bfqf8=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=RqYF4yjfFqR5DcGkj6HWrO/H8T6aJnnq5JpmWrToftc0RsyUhv1bWcUtuKr8OKplnCebzYxo8ccISpiDIAcDs3ddya0D1fsGKYD+171fotaPcskCeYgWHFj7OGTA4oztV+sMKKUPefbk15WyBUoi14Q8NUf25SEoRaxJL4tsw6Q= 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=XAu/7C3r; arc=none smtp.client-ip=91.218.175.191 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="XAu/7C3r" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=zVdDm9vWio9URlOBbk5H1FhupUhm6ZtZOBzYo8Bfqf8=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1791809752; v=1; x=1792414552; b=XAu/7C3rb/MZ5dpABy25laQ+yvYFKm3jheT5YLO5dLGM8GxZNKSkbbWwuhJ9SEenvzOqbKe+ 0YxDDs/UTQYCjF5V5k4VSp8AhWwcF4nVcYAW6TY0rLP0PqMN9sj3YrGtoc3RhOdNrYZ7YO3XjJi GbkgpeK1G0tNxMZ7rEWHlVR4= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta11.migadu.com with ESMTPS id 018eb001ca5c019a; Mon, 12 Oct 2026 12:55:25 +0000 X-Mizu-Trace-ID: 018eb001ca5c019a X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=utf-8 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 \(3901.100.1.1.12\)) Subject: Re: [PATCH v2 1/4] mm: fix missing page-table destructor in pagetable_free() From: Muchun Song In-Reply-To: Date: Mon, 12 Oct 2026 20:55:06 +0800 Cc: Muchun Song , David Hildenbrand , Oscar Salvador , Dave Hansen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Catalin Marinas , Will Deacon , Mark Rutland , Kevin Brodsky , Alexander Gordeev , Alistair Popple , linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <145CD5DC-6457-4E1E-8B9D-AE7D1EDB0AB8@linux.dev> References: <20261010112457.49485-1-songmuchun@bytedance.com> <20261010112457.49485-2-songmuchun@bytedance.com> To: "Jose A. Perez de Azpillaga" , Andrew Morton X-Mailer: Apple Mail (2.3901.100.1.1.12) > On Oct 12, 2026, at 19:15, Jose A. Perez de Azpillaga = wrote: >=20 > On Sat, Oct 10, 2026 at 07:24:54PM +0800, Muchun Song wrote: >> Since commit 49f599666420 ("mm: call ctor/dtor for kernel PTEs"), >> pte_alloc_one_kernel() runs the page-table constructor for kernel PTE >> tables. >>=20 >> HVO (HugeTLB Vmemmap Optimization) uses pte_alloc_one_kernel() when >> splitting a PMD. Restoring the vmemmap backing pages does not = collapse >> the PTE table, so a later memory hot-remove eventually frees it = through >> pagetable_free() on x86-64. That releases the page without running = the >> matching destructor and leaves NR_PAGETABLE elevated. >>=20 >> Make pagetable_free() detect constructor-backed pages and run the >> destructor before releasing their memory to fix the problem. >>=20 >> Fixes: 49f599666420 ("mm: call ctor/dtor for kernel PTEs") >> Cc: stable@vger.kernel.org >=20 > is the x86 case covered for 6.16-6.18? as far as I can see, x86 > free_pagetable() only uses pagetable_free() since bf9e4e30f353 > ("x86/mm: use pagetable_free()") in v6.19, so the backport wouldn't > change anything there. or am I missing something? Yes, you are absolutely right =E2=80=94 thanks for catching this. I double-checked and indeed x86's free_pagetable() only starts using pagetable_free() since bf9e4e30f353 ("x86/mm: use pagetable_free()"), which landed in v6.19. So for 6.16-6.18 the prerequisite is not present and the backport would be a no-op there. The correct trailer is: Cc: # 6.16-6.18: bf9e4e30f353: x86/mm: use = pagetable_free() Andrew, would you be able to update the trailer in the patch when you pick it up? If there are further review comments that require code changes, I'll fix this trailer as part of the v3 respin. Thanks a lot! Thanks, Muchun