From: Zi Yan <ziy@nvidia.com>
To: "David Hildenbrand (Red Hat)" <david@kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Wei Yang <richard.weiyang@gmail.com>,
Balbir Singh <balbirs@nvidia.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/4] mm/huge_memory: replace can_split_folio() with direct refcount calculation
Date: Wed, 26 Nov 2025 11:59:34 -0500 [thread overview]
Message-ID: <992DA160-BF2B-4D38-B76C-481F49155652@nvidia.com> (raw)
In-Reply-To: <71b8c4ab-3f4f-4b45-a9ea-706871463a83@kernel.org>
On 26 Nov 2025, at 4:56, David Hildenbrand (Red Hat) wrote:
>> static int __folio_freeze_and_split_unmapped(struct folio *folio, unsigned int new_order,
>> struct page *split_at, struct xa_state *xas,
>> struct address_space *mapping, bool do_lru,
>> struct list_head *list, enum split_type split_type,
>> - pgoff_t end, int *nr_shmem_dropped, int extra_pins)
>> + pgoff_t end, int *nr_shmem_dropped)
>> {
>> struct folio *end_folio = folio_next(folio);
>> struct folio *new_folio, *next;
>> @@ -3782,7 +3773,7 @@ static int __folio_freeze_and_split_unmapped(struct folio *folio, unsigned int n
>> VM_WARN_ON_ONCE(!mapping && end);
>> /* Prevent deferred_split_scan() touching ->_refcount */
>> ds_queue = folio_split_queue_lock(folio);
>> - if (folio_ref_freeze(folio, 1 + extra_pins)) {
>> + if (folio_ref_freeze(folio, folio_cache_ref_count(folio) + 1)) {
>> struct swap_cluster_info *ci = NULL;
>> struct lruvec *lruvec;
>> int expected_refs;
>> @@ -3853,7 +3844,7 @@ static int __folio_freeze_and_split_unmapped(struct folio *folio, unsigned int n
>> zone_device_private_split_cb(folio, new_folio);
>> - expected_refs = folio_expected_ref_count(new_folio) + 1;
>> + expected_refs = folio_cache_ref_count(new_folio) + 1;
>> folio_ref_unfreeze(new_folio, expected_refs);
>> if (do_lru)
>> @@ -3897,7 +3888,7 @@ static int __folio_freeze_and_split_unmapped(struct folio *folio, unsigned int n
>> * Otherwise, a parallel folio_try_get() can grab @folio
>> * and its caller can see stale page cache entries.
>> */
>> - expected_refs = folio_expected_ref_count(folio) + 1;
>> + expected_refs = folio_cache_ref_count(folio) + 1;
>> folio_ref_unfreeze(folio, expected_refs);
>
> Can we just get rid of the expected_refs variable as well?
OK. Will update it.
>
> Apart from that LGTM, thanks!
>
> Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Thanks.
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2025-11-26 16:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 3:50 [PATCH v3 0/4] Improve folio split related functions Zi Yan
2025-11-26 3:50 ` [PATCH v3 1/4] mm/huge_memory: change folio_split_supported() to folio_check_splittable() Zi Yan
2025-11-26 4:14 ` Balbir Singh
2025-11-26 16:55 ` Zi Yan
2025-11-26 9:54 ` David Hildenbrand (Red Hat)
2025-11-26 16:59 ` Zi Yan
2025-11-27 5:23 ` Barry Song
2025-11-26 3:50 ` [PATCH v3 2/4] mm/huge_memory: replace can_split_folio() with direct refcount calculation Zi Yan
2025-11-26 9:56 ` David Hildenbrand (Red Hat)
2025-11-26 16:59 ` Zi Yan [this message]
2025-11-26 3:50 ` [PATCH v3 3/4] mm/huge_memory: make min_order_for_split() always return an order Zi Yan
2025-11-26 3:50 ` [PATCH v3 4/4] mm/huge_memory: fix folio split stats counting Zi Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=992DA160-BF2B-4D38-B76C-481F49155652@nvidia.com \
--to=ziy@nvidia.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=balbirs@nvidia.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=nao.horiguchi@gmail.com \
--cc=npache@redhat.com \
--cc=richard.weiyang@gmail.com \
--cc=ryan.roberts@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox