Thread (41 messages) 41 messages, 7 authors, 2019-08-13

Re: [PATCH v2 01/34] mm/gup: add make_dirty arg to put_user_pages_dirty_lock()

From: John Hubbard <jhubbard@nvidia.com>
Date: 2019-08-06 20:39:30
Also in: amd-gfx, ceph-devel, dri-devel, intel-gfx, kvm, linux-arm-kernel, linux-block, linux-crypto, linux-fsdevel, linux-media, linux-mm, linux-nfs, linux-rdma, linux-xfs, lkml, netdev, sparclinux, xen-devel

On 8/6/19 10:39 AM, Ira Weiny wrote:
On Sun, Aug 04, 2019 at 03:48:42PM -0700, john.hubbard@gmail.com wrote:
quoted
From: John Hubbard <jhubbard@nvidia.com>
...
quoted
-
 /**
- * put_user_pages_dirty() - release and dirty an array of gup-pinned pages
- * @pages:  array of pages to be marked dirty and released.
+ * put_user_pages_dirty_lock() - release and optionally dirty gup-pinned pages
+ * @pages:  array of pages to be maybe marked dirty, and definitely released.
Better would be.

@pages:  array of pages to be put
OK, I'll change to that wording.
quoted
  * @npages: number of pages in the @pages array.
+ * @make_dirty: whether to mark the pages dirty
  *
  * "gup-pinned page" refers to a page that has had one of the get_user_pages()
  * variants called on that page.
  *
  * For each page in the @pages array, make that page (or its head page, if a
- * compound page) dirty, if it was previously listed as clean. Then, release
- * the page using put_user_page().
+ * compound page) dirty, if @make_dirty is true, and if the page was previously
+ * listed as clean. In any case, releases all pages using put_user_page(),
+ * possibly via put_user_pages(), for the non-dirty case.
I don't think users of this interface need this level of detail.  I think
something like.

 * For each page in the @pages array, release the page.  If @make_dirty is
 * true, mark the page dirty prior to release.
Yes, it is too wordy, I'll change to that.
...
quoted
-void put_user_pages_dirty_lock(struct page **pages, unsigned long npages)
-{
-	__put_user_pages_dirty(pages, npages, set_page_dirty_lock);
+	/*
+	 * TODO: this can be optimized for huge pages: if a series of pages is
+	 * physically contiguous and part of the same compound page, then a
+	 * single operation to the head page should suffice.
+	 */
I think this comment belongs to the for loop below...  or just something about
how to make this and put_user_pages() more efficient.  It is odd, that this is
the same comment as in put_user_pages()...
Actually I think I'll just delete the comment entirely, it's just noise really.
The code is good.  So... Other than the comments.

Reviewed-by: Ira Weiny <redacted>

Thanks for the review!


thanks,
-- 
John Hubbard
NVIDIA
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help