[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3e5df0cf-d2bd-7795-617d-06a3a32fc18b@redhat.com>
Date: Fri, 27 Jan 2023 01:10:39 +0100
From: David Hildenbrand <david@...hat.com>
To: David Howells <dhowells@...hat.com>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
Jens Axboe <axboe@...nel.dk>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
Jason Gunthorpe <jgg@...dia.com>,
Logan Gunthorpe <logang@...tatee.com>,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Christoph Hellwig <hch@....de>,
John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH v11 2/8] iov_iter: Add a function to extract a page list
from an iterator
On 27.01.23 00:56, David Howells wrote:
> Al says that pinning a page (ie. FOLL_PIN) could cause a deadlock if a page is
> vmspliced into a pipe with the pipe holding a pin on it because pinned pages
> are removed from all page tables. Is this actually the case? I can't see
> offhand where in mm/gup.c it does this.
Pinning a page is mostly taking a "special" reference on the page,
indicating to the system that the page maybe pinned. For an ordinary
order-0 page, this is increasing the refcount by 1024 instead of 1.
In addition, we'll do some COW-unsharing magic depending on the page
type (e.g., anon vs. fike-backed), and FOLL_LONGTERM. So if the page is
mapped R/O only and we want to pin it R/O (!FOLL_WRITE), we might
replace it in the page table by a different page via a fault
(FAULT_FLAG_UNSHARE).
Last but not least, with FOLL_LONGTERM we will make sure to migrate the
target page off of MIGRATE_MOVABLE/CMA memory where the unmovable page
(while pinned) could otherwise cause trouble (e.g., blocking memory
hotunplug). So again, we'd replace it in the page tale by a different
page via a fault.
In all cases, the page won't be unmapped from the page table.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists