开发者

Issuing an asnyc I/O on a page

开发者 https://www.devze.com 2023-03-20 17:33 出处:网络
I was wondering what the correct way of issuing an asynchronous read operation on a pa开发者_运维技巧ge that has been swapped out is. And once this is done is there a way to execute a callback that ha

I was wondering what the correct way of issuing an asynchronous read operation on a pa开发者_运维技巧ge that has been swapped out is. And once this is done is there a way to execute a callback that happens so that I can execute some logic with that page?


madvise(start_address, length, MADV_WILLNEED) will do that.

A callback does not really exist, though you can poll a snapshot of the status with the mincore syscall, if you want.

Note that the opposite hint MADV_DONTNEED does not do what you think, nor does msync. The documentation is lying.
There is no non-broken-by-design way to start asynchronous writeback under Linux (although the documentation says so). You can choose between no-op, throwing pages away, synchronous writeback, or asynchronous writeback with purging the cache.

0

精彩评论

暂无评论...
验证码 换一张
取 消