Thread (19 messages) 19 messages, 5 authors, 2021-02-28

Re: [RFC 0/6] x86: prefetch_page() vDSO call

From: Nadav Amit <hidden>
Date: 2021-02-25 18:02:43
Also in: lkml

On Feb 25, 2021, at 9:32 AM, Matthew Wilcox [off-list ref] wrote:

On Thu, Feb 25, 2021 at 04:56:50PM +0000, Nadav Amit wrote:
quoted
quoted
On Feb 25, 2021, at 4:16 AM, Matthew Wilcox [off-list ref] wrote:

On Wed, Feb 24, 2021 at 11:29:04PM -0800, Nadav Amit wrote:
quoted
Just as applications can use prefetch instructions to overlap
computations and memory accesses, applications may want to overlap the
page-faults and compute or overlap the I/O accesses that are required
for page-faults of different pages.
Isn't this madvise(MADV_WILLNEED)?
Good point that I should have mentioned. In a way prefetch_page() a
combination of mincore() and MADV_WILLNEED.

There are 4 main differences from MADV_WILLNEED:

1. Much lower invocation cost if the readahead is not needed: this allows
to prefetch pages more abundantly.
That seems like something that could be fixed in libc -- if we add a
page prefetch vdso call, an application calling posix_madvise() could
be implemented by calling this fast path.  Assuming the performance
increase justifies this extra complexity.
quoted
2. Return value: return value tells you whether the page is accessible.
This makes it usable for coroutines, for instance. In this regard the
call is more similar to mincore() than MADV_WILLNEED.
I don't quite understand the programming model you're describing here.
quoted
3. The PTEs are mapped if the pages are already present in the
swap/page-cache, preventing an additional page-fault just to map them.
We could enhance madvise() to do this, no?
quoted
4. Avoiding heavy-weight reclamation on low memory (this may need to
be selective, and can be integrated with MADV_WILLNEED).
Likewise.

I don't want to add a new Linux-specific call when there's already a
POSIX interface that communicates the exact same thing.  The return
value seems like the only problem.
I agree that this call does not have to be exposed to the application.

I am not sure there is a lot of extra complexity now, but obviously
some evaluations are needed.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help