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 7FC8F3093DB for ; Tue, 28 Apr 2026 13:01:19 +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=1777381279; cv=none; b=SoisaGtrunJUGRC6X2y+yXxOMrvGQkZnD8fqs5o0s2z8wjt+7vDLiE0buHFIxP4kGbCV8wUZ5eDs5aanI8CIBZzls3mf13dxyViRMvtGc7yVQmdw9BdZ5H8M/J+QlFztKYhiMj6VY/dxVew3xtoktIZgbimHNlc7oNbr2gNXYbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777381279; c=relaxed/simple; bh=6dJQUEH+z2Cv8SxLL12FE1CYpvHAqBF/SiN0HelMoMk=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=fbaVEkOqfjxBZ3oUk2+cAWHlyvKjluGtp4qta0WpM9pDqHm6AaH/b7/iOgvrJ2deZRm/15UOvCr/33scGDLagBnXsOp9/P3bXbDVw7fWePXN7h0faKDNtKFjCcqhmJ0NMF5whSJBAQ2i2YDZfIIor361Vi8fQo1jRoKWs0WMK6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=MCUblZv4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="MCUblZv4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AFD7C2BCAF; Tue, 28 Apr 2026 13:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777381276; bh=6dJQUEH+z2Cv8SxLL12FE1CYpvHAqBF/SiN0HelMoMk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MCUblZv43krP5yOYUlym9kKM7eTJ5bM8xgcUnmrf1e9hT8R8Bn/t1OZnZ/vyj/tHX qwop6mchfCVpVdrA8PpHsAdRbvRISNb5eGGyEux6i3i6U0LbuAEpNiSXiN8D8b3DB4 NjTcwk0sXA65Gaw+pQV0yYrQhQfkoiMccPfmjB5Y= Date: Tue, 28 Apr 2026 06:01:15 -0700 From: Andrew Morton To: Barry Song Cc: "David Hildenbrand (Arm)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Lance Yang , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park Subject: Re: [PATCH] mm/huge_memory: Fix outdated comment about freeing subpages in __folio_split Message-Id: <20260428060115.84c55bcf72315c01b86e0c90@linux-foundation.org> In-Reply-To: References: <20260423034917.8234-1-baohua@kernel.org> <17a3bc38-0d97-4316-b2fb-02a91202c504@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 8bit On Tue, 28 Apr 2026 18:32:40 +0800 Barry Song wrote: > On Tue, Apr 28, 2026 at 6:08 PM David Hildenbrand (Arm) > wrote: > > > > On 4/28/26 12:05, Barry Song wrote: > > > On Mon, Apr 27, 2026 at 3:42 PM David Hildenbrand (Arm) > > > wrote: > > >> > > >> On 4/26/26 22:42, Barry Song wrote: > > >>> On Thu, Apr 23, 2026 at 8:36 PM David Hildenbrand (Arm) > > >>> wrote: > > >>> > > >>> Thanks, david! would it make more sense to add “when > > >>> CONFIG_PAGE_MAPCOUNT is enabled” at the end of the > > >>> sentence? > > >> > > >> Better to phrase it in a way that doesn't even require these details :) > > >> > > >> Do we even need this detail in the patch description? > > > > > > What about: > > > > > > The comment appears to be outdated. add_to_swap() no longer exists, > > > and the explanation of why we need to call put_page() after > > > splitting could be made more general. > > > > Jup :) > > Thanks! > Hi Andrew, would you like to make the change in the > changelog, or would you prefer that I send a new version? This? From: "Barry Song (Xiaomi)" Subject: mm/huge_memory: fix outdated comment about freeing subpages in __folio_split Date: Thu, 23 Apr 2026 11:49:17 +0800 The comment appears to be outdated. add_to_swap() no longer exists, and the explanation of why we need to call put_page() after splitting could be made more general. Link: https://lore.kernel.org/20260423034917.8234-1-baohua@kernel.org Signed-off-by: Barry Song (Xiaomi) Acked-by: David Hildenbrand (Arm) Acked-by: Zi Yan Cc: Lorenzo Stoakes Cc: Baolin Wang Cc: Liam R. Howlett Cc: Nico Pache Cc: Ryan Roberts Cc: Dev Jain Cc: Lance Yang Cc: Chris Li Cc: Kairui Song Cc: Kemeng Shi Cc: Nhat Pham Cc: Baoquan He Cc: Youngjun Park Signed-off-by: Andrew Morton --- mm/huge_memory.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/mm/huge_memory.c~mm-huge_memory-fix-outdated-comment-about-freeing-subpages-in-__folio_split +++ a/mm/huge_memory.c @@ -4190,11 +4190,10 @@ fail: folio_unlock(new_folio); /* - * Subpages may be freed if there wasn't any mapping - * like if add_to_swap() is running on a lru page that - * had its mapping zapped. And freeing these pages - * requires taking the lru_lock so we do the put_page - * of the tail pages after the split is complete. + * Subpages whose mapping has been zapped may be freed + * earlier, but freeing them requires taking the + * lru_lock, so we defer put_page() on tail pages until + * after the split completes. */ free_folio_and_swap_cache(new_folio); } _