From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 50E3E39DBDD for ; Mon, 23 Mar 2026 12:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774268707; cv=none; b=bblLPH2QL49SDXshZaBjal8hw15RYGiuugIiR16OFEMDG/Vpk9G+NHYq4aV6BwPi/leS5cdqC9OSfI53EEBgymVMcyDTyQp/TvOhj9P+TnvRopNbwLIwkfQAxZgjXVUJ9TEquDnXl77Ad/0PlC1Xm16zR32sM4T4iHHmOyQVW/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774268707; c=relaxed/simple; bh=ZaVyichs/RRfk2MX4rNXjPKozCC5RWlOoxEpm8yp1+Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZE6VUwTBVn5FZUT2pHjR6Hbm9YDx/+QMHFnb7U0U3uhCDs+zMEsf/Pqh1cRf7sKar8P5yq+SEh2oDQGDtGNU6LSH6SZndaCExYKQvPjS9CM7R1RTusDMVABWVIHVgKmrZoBk1GqN7a7wI9vv5eMWpwPIYpL120nTWCplU/uZPFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=drHbWPoW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="drHbWPoW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEF36C4CEF7; Mon, 23 Mar 2026 12:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774268706; bh=ZaVyichs/RRfk2MX4rNXjPKozCC5RWlOoxEpm8yp1+Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=drHbWPoWQ/hFqgM7MrihWQFuhhqCFbPKQFrNzl7qxK5i4OL5xfLUWmkPc7ZyOuOzL iDAVSG+TvprLudKR1MO/Zl3GzZ9j/6j/3bubSysOBaAHTDVeWGMzF5H8V88qwhqVYY uDb5wrSFTOvG0s2ZgPpui2JVL8eolZFmXvvfglD3ghhJwLwaDpLKDr7aCPV/vn5d8j 0MmBvOQxBxha8J+zMBxhSs0oIlocfdfyWqh82XyH9sxHqiN9oFjNrdPf9rDM5k/7f7 TLAMCAqGq1BF6KdwNl09I925tA3F+4mvAma9DVoNbVXUJCQ/ay1F3dxxcbngIsUDLm 2W2plRqaVx/fw== Date: Mon, 23 Mar 2026 12:25:02 +0000 From: "Lorenzo Stoakes (Oracle)" To: Andrew Morton Cc: David Hildenbrand , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Kiryl Shutsemau , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 13/13] mm/huge_memory: add and use has_deposited_pgtable() Message-ID: <0a917f80-902f-49b0-a75f-1bbaf23d7f94@lucifer.local> References: <97a35411-3482-42d5-b0ea-31a5994956b2@lucifer.local> 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: <97a35411-3482-42d5-b0ea-31a5994956b2@lucifer.local> On Mon, Mar 23, 2026 at 11:45:23AM +0000, Lorenzo Stoakes (Oracle) wrote: > Hi Andrew, > > Could you apply the below fix-patch to resolve an issue with us performing > folio_put() on a folio before checking it again to see if a table was > deposited, as per Sashiko. > > This patch resolves the issue by storing whether or not this is the case in > a has_deposit local variable (as used previously) before invoking > zap_huge_pmd_folio(), then using this boolean to determine whether or not > to zap any deposited table. Oops this is wrong...! Please apply the below instead :) Thanks, Lorenzo ----8<---- >From e6d58747d00dd954c605201e97f8b769b2ba8cf8 Mon Sep 17 00:00:00 2001 From: "Lorenzo Stoakes (Oracle)" Date: Mon, 23 Mar 2026 11:42:01 +0000 Subject: [PATCH] fix Signed-off-by: Lorenzo Stoakes (Oracle) --- mm/huge_memory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 610a6184e92c..b2a6060b3c20 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2397,6 +2397,7 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, struct mm_struct *mm = tlb->mm; struct folio *folio = NULL; bool is_present = false; + bool has_deposit; spinlock_t *ptl; pmd_t orig_pmd; @@ -2418,10 +2419,10 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, is_present = pmd_present(orig_pmd); folio = normal_or_softleaf_folio_pmd(vma, addr, orig_pmd, is_present); + has_deposit = has_deposited_pgtable(vma, orig_pmd, folio); if (folio) zap_huge_pmd_folio(mm, vma, orig_pmd, folio, is_present); - - if (has_deposited_pgtable(vma, orig_pmd, folio)) + if (has_deposit) zap_deposited_table(mm, pmd); spin_unlock(ptl); -- 2.53.0