|
From: | Richard Henderson |
Subject: | Re: [PATCH 15/22] Implement mlock(2), munlock(2), mlockall(2), munlockall(2), madvise(2), minherit(2) |
Date: | Sun, 20 Aug 2023 07:42:00 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 8/19/23 21:37, Warner Losh wrote:
+/* madvise(2) */ +static inline abi_long do_bsd_madvise(abi_long arg1, abi_long arg2, + abi_long arg3) +{ + /* + * A straight passthrough may not be safe because qemu sometimes + * turns private file-backed mapping into anonymous mappings. This + * will break MADV_DONTNEED. This is a hint, so ignoring and returing + * success is ok. + */ + return get_errno(0); This looks like it was copied from an early linux-user implementation, and that seems to have been fixed to no longer cause problems. Can someone that knows about the linux-user history here comment?
We now track pages that are "passthrough" and ok for DONTNEED etc. case MADV_DONTNEED: if (page_check_range(start, len, PAGE_PASSTHROUGH)) { ret = get_errno(madvise(g2h_untagged(start), len, advice)); if ((advice == MADV_DONTNEED) && (ret == 0)) { page_reset_target_data(start, start + len - 1); } } It's still not ideal, but it's something. r~
[Prev in Thread] | Current Thread | [Next in Thread] |