From: David Hildenbrand <david@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>, linux-mm@kvack.org
Cc: Jason Gunthorpe <jgg@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>,
Nicolin Chen <nicolinc@nvidia.com>,
iommu@lists.linux.dev, Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH V1 1/9] mm/gup: repin_folio_unhugely
Date: Thu, 26 Sep 2024 13:38:34 +0200 [thread overview]
Message-ID: <0e8a9f2f-5c22-46a9-929a-f986c3f5e476@redhat.com> (raw)
In-Reply-To: <ca95e882-46a5-4510-a0a4-2c12a01b1f9f@oracle.com>
>>> reference fiddling is skipped.
>>
>> Please point me in mm/gup.c at that handling.
>>
>> IIRC is_zero_folio() does *not* include the huge zero page.
>>
>> Yes, we should likely be special-casing the huge zeropage in mm/gup.c, but it's not that easy because PINs can outlive MMs ... so *not* grabbing a reference could currently be harmful.
>>
>> But that has do be changed consistently, not with doing things here different compared to other gup.c functions.
>
Sorry for the late reply, conferences ...
> folios_put() -> folios_put_refs() -> is_huge_zero_folio()
unpin_user_folio() -> gup_put_folio() will do
1) atomic_sub(refs, &folio->_pincount);
2) folio_put_refs(folio, refs);
What you cite above is for releasing huge folios that are mapped into
user space.
>
> I will run some tests with huge zero folios to verify the ref and pin
> counts behave correctly.
Whatever is pinned is supposed to be released via the unpin interface.
We have to be consistent there, so this patch would be wrong (likely you
never get the huge zero folio).
>
>>>>>> + return;
>>>>>> + atomic_add(npin - 1, &folio->_refcount);
>>>>>> + atomic_add(npin - 1, &folio->_pincount);
>>>>>> +}
>>>>>> +EXPORT_SYMBOL_GPL(repin_folio_unhugely);
>>>>
>>>> Can we ... find a better name? For example, it's "large" folio not "huge"...
>>>>
>>>> And repin is really misleading. We are simply adding more pins to an already pinned one ...
>>>
>>> Jason suggests a better name in the other thread.
>>
>> I would prefer something that simply adds more pins to an already pinned folio. Much easier to get.
>
> How about folio_add_pins()?
Something like that, but more importantly, via which interface did we
obtain the pins? That will make a difference and should be documented.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-09-26 11:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1726319158-283074-1-git-send-email-steven.sistare@oracle.com>
[not found] ` <1726319158-283074-2-git-send-email-steven.sistare@oracle.com>
2024-09-14 13:19 ` Steven Sistare
2024-09-17 12:25 ` David Hildenbrand
2024-09-18 14:51 ` Steven Sistare
2024-09-19 8:11 ` David Hildenbrand
2024-09-19 21:06 ` Steven Sistare
2024-09-26 11:38 ` David Hildenbrand [this message]
2024-09-20 13:28 ` Jason Gunthorpe
2024-09-26 11:32 ` David Hildenbrand
2024-09-26 11:40 ` Jason Gunthorpe
2024-09-26 12:57 ` David Hildenbrand
2024-09-26 12:58 ` David Hildenbrand
[not found] ` <ZudFcANtENlaRJ+r@nvidia.com>
2024-09-18 14:51 ` Steven Sistare
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=0e8a9f2f-5c22-46a9-929a-f986c3f5e476@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=linux-mm@kvack.org \
--cc=nicolinc@nvidia.com \
--cc=steven.sistare@oracle.com \
--cc=willy@infradead.org \
/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