Thread (31 messages) 31 messages, 5 authors, 2022-09-01

Re: [PATCH 2/6] block: add dio_w_*() wrappers for pin, unpin user pages

From: John Hubbard <jhubbard@nvidia.com>
Date: 2022-08-28 00:31:40
Also in: linux-fsdevel, linux-mm, linux-nfs, linux-xfs, lkml

On 8/27/22 17:12, Andrew Morton wrote:
On Sat, 27 Aug 2022 16:59:32 -0700 John Hubbard [off-list ref] wrote:
quoted
Anyway, I'll change my patch locally for now, to this:

static inline void dio_w_unpin_user_pages(struct page **pages,
					  unsigned long npages)
{
	/* Careful, release_pages() uses a smaller integer type for npages: */
	if (WARN_ON_ONCE(npages > (unsigned long)INT_MAX))
		return;

	release_pages(pages, (int)npages);
}
Well, it might be slower.  release_pages() has a ton of fluff.

As mentioned, the above might be faster if the pages tend
to have page_count()==1??
I don't think we can know the answer to that. This code is called
in all kinds of situations, and it seems to me that whatever
tradeoffs are best for release_pages(), are probably also reasonable
for this code.

Even with all the fluff in release_pages(), it at least batches
the pages, as opposed to the simple put_page() in a loop. Most of 
the callers do have more than one page to release in non-error cases,
so release_pages() does seem better.


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