From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6D4E03C3F50 for ; Thu, 10 Sep 2026 08:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789029817; cv=none; b=sAJeGF9S8eJuw2lckCD66khDeFPDg6Hew3/CEeN1LLmkoId5AkYTZycdqMs4ntCfjGDKA5lXQ4KxKcOAsrlvNDzoIW550Ap6Nge2rt48GuXBiZqw83ZyDAsnFuHV3byjcbVDOFumwlmo7eHCqnQ0/od6V1Hvmtl8qk0bQR/nzEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789029817; c=relaxed/simple; bh=BG/DRD0nKaXtOAyVL22YMEpkeM5K3QZNt4MoMfadPqo=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=K0coeWIpQKq/AvR5OX3rg6Jx17hqlokj6Nmh64CN0wWV4+lscyzvg56x6yn0+ayMhbxl0ZvL41ZeMBx5CYqx2VKupoGLb7CtJ1iOGmfGOHkJA19oLxILGAMP6TPJ7PyTU/f9kgJ7gUDe6fQM3BBE1Q4QodRnFmWHQOE3WIXJF5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=byq2LKLh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="byq2LKLh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29E2E1F000FF; Thu, 10 Sep 2026 08:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789029813; bh=isEbLjZPk/dWe3bh3R3NrHmu/Mf2w2fxrs7ayu2qcdw=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=byq2LKLh5wTPUorRM31M4sIDve1usn/sR9AsugS+bvOrGQ0q2EKGgRVXELonBPepU Gn/ViuRSmp4XQJIJwRhWXFWkxkPKm2DGlFogH16zZxZ4iQ+ZT657K+3xZK25i/81Ba /x9+5v5YgJ/Ss1CNrGmD1seqX2AeaYn3Rr6m+Y3DTYKPFs/q+eB8Z4G12iJU0ttEVS FO3rPrBkfjpUK1Xapvv8Y6OhQTd8GKz4pDNUe7SJmYLqM0XOoH+1pPTyY8r0Qp7xJI usAbolvU3Qop8LaA1p6AQexHn/SCerYpxEyDLJh0l50wTRBXHITBGPYo166RCBroFP bfg4rcYtiE2Qw== Message-ID: Date: Thu, 10 Sep 2026 16:43:27 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jaegeuk Kim , linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH v3 06/14] f2fs: stop using PG_private To: "David Hildenbrand (Arm)" , Zi Yan , "Matthew Wilcox (Oracle)" , Andrew Morton , Muchun Song , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Gregory Price , Ying Huang , Alistair Popple , Johannes Weiner , Qi Zheng , Shakeel Butt , Kairui Song References: <20260907-remove-pg_private-v3-0-6ae22f9d9272@nvidia.com> <20260907-remove-pg_private-v3-6-6ae22f9d9272@nvidia.com> <7e11c56d-05e6-48f0-b5b8-b4a0e18ddc1d@kernel.org> <520b6aca-b515-4720-977f-1adb484f2e08@kernel.org> Content-Language: en-US From: Chao Yu In-Reply-To: <520b6aca-b515-4720-977f-1adb484f2e08@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 9/10/26 15:34, David Hildenbrand (Arm) wrote: > On 9/10/26 04:41, Chao Yu wrote: >> On 9/8/26 23:47, David Hildenbrand (Arm) wrote: >>> On 9/8/26 04:56, Zi Yan wrote: >>>> f2fs sets its PAGE_PRIVATE_* flags in page->private and checking >>>> page->private != NULL is equivalent to checking PG_private. Change >>>> PagePrivate() to page_private(). Meanwhile, in set_page_private_##name(), >>>> page->private is first set to 0/NULL before an PAGE_PRIVATE_* flag is set, >>>> but it can cause confusion when PG_private is removed and >>>> page->private != NULL is used instead. Change it to initialize >>>> page->private to PAGE_PRIVATE_NOT_POINTER instead and retain the original >>>> semantics. >>>> >>>> It prepares for a future commit that removes PG_private. >>>> >>>> No functional change intended. >>>> >>>> Assisted-by: Claude:claude-opus-4-8 >>>> Assisted-by: Codex:gpt-5 >>>> To: Jaegeuk Kim >>>> To: Chao Yu >>>> Cc: linux-f2fs-devel@lists.sourceforge.net >>>> Cc: linux-kernel@vger.kernel.org >>>> Acked-by: Usama Arif >>>> Acked-by: Chao Yu >>>> Signed-off-by: Zi Yan >>>> --- >>>> fs/f2fs/f2fs.h | 8 ++++---- >>>> 1 file changed, 4 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >>>> index 9940a6cecf1a2..2f7ab5888b078 100644 >>>> --- a/fs/f2fs/f2fs.h >>>> +++ b/fs/f2fs/f2fs.h >>>> @@ -2691,7 +2691,7 @@ static inline bool folio_test_f2fs_##name(const struct folio *folio) \ >>>> } \ >>>> static inline bool page_private_##name(struct page *page) \ >>>> { \ >>>> - return PagePrivate(page) && \ >>>> + return page_private(page) && \ >>>> test_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)) && \ >>>> test_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \ >>>> } >>>> @@ -2710,9 +2710,9 @@ static inline void folio_set_f2fs_##name(struct folio *folio) \ >>>> } \ >>>> static inline void set_page_private_##name(struct page *page) \ >>>> { \ >>>> - if (!PagePrivate(page)) \ >>>> - attach_page_private(page, (void *)0); \ >>>> - set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); \ >>>> + if (!page_private(page)) \ >>>> + attach_page_private(page, \ >>>> + (void *)BIT(PAGE_PRIVATE_NOT_POINTER)); \ >>>> set_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \ >>>> } >>> >>> Very weird interface. Why do we even need the page-based interface still? >>> >>> $ git grep -E "(set|clear)_page_private" >>> compress.c: clear_page_private_gcing(cc->rpages[i]); >>> compress.c: set_page_private_gcing(cc->rpages[i]); >>> compress.c: clear_page_private_gcing(cic->rpages[i]); >>> f2fs.h:static inline void set_page_private_##name(struct page *page) \ >>> f2fs.h:static inline void clear_page_private_##name(struct page *page) \ >>> >>> Seeing code like: >>> >>> clear_page_private_gcing(cc->rpages[i]); >>> if (folio_test_writeback(page_folio(cc->rpages[i]))) >>> end_page_writeback(cc->rpages[i]); >>> >>> Makes me wonder whether we can just use the folio helper instead? >>> >>> In f2fs_iget(), we enable large folios only when !f2fs_compressed_file(inode). >>> >>> So naive me would assume that we can just get rid of the >>> set_page_private_/clear_page_private_ stuff entirely. >> >> David, >> >> Thanks for the patch, at a glance, it seems fine, can you please send >> a formal patch? then we can apply to dev-test for test. > > I'm hoping Zi will drag that along as part of this patch set. Is this fine or do Oh, I see. > you want it sent as a complete standalone patch (will make merging Zi's series > slightly more complicated :) ). I think sending as a separated patch based on Zi Yan's patch is fine, since the purpose of this patch is a little different from Zi's one. Note that: ("f2fs: stop using PG_private") has been merged in https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/log/?h=dev-test, Thanks,