[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5b5b0aa-21c4-4abf-b323-63af96aabcd5@redhat.com>
Date: Thu, 26 Jun 2025 10:17:13 +0200
From: David Hildenbrand <david@...hat.com>
To: Lance Yang <lance.yang@...ux.dev>, Barry Song <21cnbao@...il.com>
Cc: akpm@...ux-foundation.org, baolin.wang@...ux.alibaba.com,
chrisl@...nel.org, kasong@...cent.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-riscv@...ts.infradead.org, lorenzo.stoakes@...cle.com,
ryan.roberts@....com, v-songbaohua@...o.com, x86@...nel.org,
ying.huang@...el.com, zhengtangquan@...o.com,
Lance Yang <ioworker0@...il.com>
Subject: Re: [PATCH v4 3/4] mm: Support batched unmap for lazyfree large
folios during reclamation
On 26.06.25 03:17, Lance Yang wrote:
>
>
> On 2025/6/26 05:03, Barry Song wrote:
>> On Thu, Jun 26, 2025 at 12:25 AM David Hildenbrand <david@...hat.com> wrote:
>>>
>>> On 25.06.25 14:20, Lance Yang wrote:
>> [...]
>>>> Hmm... I have a question about the reference counting here ...
>>>>
>>>> if (vma->vm_flags & VM_LOCKED)
>>>> mlock_drain_local();
>>>> folio_put(folio);
>>>> /* We have already batched the entire folio */
>>>>
>>>> Does anyone else still hold a reference to this folio after folio_put()?
>>>
>>> The caller of the unmap operation should better hold a reference :)
>>>
>>> Also, I am not sure why we don't perform a
>>>
>>> folio_put_refs(folio, nr_pages);
>>
>> Because we've already called folio_ref_sub(folio, nr_pages - 1);
>> Looking back, it’s kind of ugly, huh.
>>
>> discard:
>> if (unlikely(folio_test_hugetlb(folio))) {
>> hugetlb_remove_rmap(folio);
>> } else {
>> folio_remove_rmap_ptes(folio, subpage, nr_pages, vma);
>> folio_ref_sub(folio, nr_pages - 1);
>> }
>>
>> I assume Lance will send a patch? If so, remember to remove this
>> when switching to folio_put_refs(folio, nr_pages);
>
> Ah, got it. Thanks for pointing that out!
Obviously I was hinting that the split refcount update can be merged
into a single refcount update :)
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists