linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: David Howells <dhowells@redhat.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	John Hubbard <jhubbard@nvidia.com>
Cc: hch@infradead.org, willy@infradead.org, linux-mm@kvack.org
Subject: Re: Does GUP page unpinning have to be done in the pinning context?
Date: Fri, 4 Apr 2025 12:29:47 +0200	[thread overview]
Message-ID: <67d4486b-658e-4f3f-9a67-8785616e6905@redhat.com> (raw)
In-Reply-To: <939183.1743762009@warthog.procyon.org.uk>

On 04.04.25 12:20, David Howells wrote:
> Hi Kirill, John, David,

Hi,

> 
> I don't know if you're the experts on GUP, but can you tell me if unpinning,
> e.g. unpin_user_page(), needs to be done in the same MM context and/or the
> same user context as the initial pinning?  And, if so, is there some way to
> break that link?

gup_put_folio() seems to only rely on per-folio information (esp. 
node_stat_mod_folio).

So there should not be such a context requirement.

> 
> I'm looking at how I might extend page pinning into the socket layer and
> sendmsg(MSG_ZEROCOPY).  The problem is that sendmsg() merely queues the
> buffers with no guarantee that it's finished with them by the time it's
> returned.  You get a SO_EE_ORIGIN_ZEROCOPY message to tell you that.
> 
> I have to deal with the issue that the process that did the sendmsg(), the MM
> context and the user context may all have ceased to exist by the time the
> transmission completes if I don't pin them.

AFAIKS that should work.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-04-04 10:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04 10:20 David Howells
2025-04-04 10:29 ` David Hildenbrand [this message]
2025-04-04 16:59   ` John Hubbard
2025-04-07  6:39     ` Christoph Hellwig
2025-04-10  2:56       ` John Hubbard
2025-04-10  7:28         ` Christoph Hellwig
2025-04-10 19:11           ` John Hubbard
2025-04-10 19:14             ` Matthew Wilcox
2025-04-10 19:34               ` John Hubbard
2025-05-12  6:21             ` Christoph Hellwig

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=67d4486b-658e-4f3f-9a67-8785616e6905@redhat.com \
    --to=david@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=jhubbard@nvidia.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --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