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 6755B389E07 for ; Mon, 30 Mar 2026 09:54:43 +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=1774864483; cv=none; b=h7NkIjSv4wTz6eqV3fCTDGPh3fn4vna1AVcS6a5WpbwWV7bt/wc/TIZ4sLa8z2aNST7Q3HCZ/D/x6VoEdsZx/iwLzEfca8zv9P0StWlHqAuumidGfsGFmQTCk67CwX9kqUlCQTU/0+2OoIpepXhxTN9/YAeLZIoiS6fJIQuYf2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774864483; c=relaxed/simple; bh=P5+O18KEaXJRb7s7QQUjjetgg5oimgVFhgzsPVOEJoc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uSyxeZwHJCVw8tXKsQo7Pe3Y9yPZtkU//724BIivU4SBtpeX6ST60r2eb/xYxu20wkqjm0U1VHk/S88ktD/HC1wCsYR6ri6p6HuxJ/bndtmcbcZcIoI/tExsTYQdPBl7bGJpiV612sc0MaLpCbqlLELOq9ZaudSlhQ9tfh/UKfM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=omqfLIJ3; 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="omqfLIJ3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50F84C4CEF7; Mon, 30 Mar 2026 09:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774864483; bh=P5+O18KEaXJRb7s7QQUjjetgg5oimgVFhgzsPVOEJoc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=omqfLIJ3ogwBfKm/f9OK3gZb5PqY39BCCkmDJBraM0O2KAKgWnPYmXJbyWP3HA84x c0k7yMJXYZqmdqwqt+fHBpkDebzwf8JpggFU1Fo42qt2zNh/8T6HeEK0QjnL6hBche yiqX21c1tFAX7ZIPX3emaK2v7BRxMrYRvjv6tEsAL+4Zqrkme8YuVZhHwlrLdaDKyU PfUTSLnyvNdivcZIFAoVC2Kr7wZZdH04cVnuvv1oHn2OevCMzwPznp1Xr3vkR+LgJb BhEVUl/nPoQKlMykLef1y0RIYsvWunrcaHl1Fcsjr1b7HmctEYy1Kcw97RvGsgJ8u2 2QsasUoU2dt4Q== Date: Mon, 30 Mar 2026 10:54:37 +0100 From: "Lorenzo Stoakes (Oracle)" To: Suren Baghdasaryan Cc: Andrew Morton , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Vlastimil Babka , Mike Rapoport , 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: <9679449b-1078-4a23-95b7-e92e26259816@lucifer.local> References: <97a35411-3482-42d5-b0ea-31a5994956b2@lucifer.local> <0a917f80-902f-49b0-a75f-1bbaf23d7f94@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sat, Mar 28, 2026 at 12:54:38PM -0700, Suren Baghdasaryan wrote: > On Mon, Mar 23, 2026 at 5:25 AM Lorenzo Stoakes (Oracle) wrote: > > > > 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 > > With the fix LGTM. Overall very nice cleanup making the code much more > readable. Thanks Lorenzo! Thanks :) > > Reviewed-by: Suren Baghdasaryan Thanks for the review! Cheers, 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