summary refs log tree commit diff stats
path: root/include/exec
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2022-09-06 02:08:38 +0200
committerLaurent Vivier <laurent@vivier.eu>2022-09-27 09:30:46 +0200
commitf93b76958a358e82bfdd1474598fe75184afeb4d (patch)
tree12afdebbd88ade70a4313fd25f54db9f33349ad9 /include/exec
parent375ce49be285c5ff73674674350cc99807dfac83 (diff)
downloadfocaccia-qemu-f93b76958a358e82bfdd1474598fe75184afeb4d.tar.gz
focaccia-qemu-f93b76958a358e82bfdd1474598fe75184afeb4d.zip
linux-user: Passthrough MADV_DONTNEED for certain file mappings
This is a follow-up for commit 892a4f6a750a ("linux-user: Add partial
support for MADV_DONTNEED"), which added passthrough for anonymous
mappings. File mappings can be handled in a similar manner.

In order to do that, mark pages, for which mmap() was passed through,
with PAGE_PASSTHROUGH, and then allow madvise() passthrough for these
pages. Drop the explicit PAGE_ANON check, since anonymous mappings are
expected to have PAGE_PASSTHROUGH anyway.

Add PAGE_PASSTHROUGH to PAGE_STICKY in order to keep it on mprotect().

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220725125043.43048-1-iii@linux.ibm.com>
Message-Id: <20220906000839.1672934-5-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'include/exec')
-rw-r--r--include/exec/cpu-all.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 491629b9ba..16b7df41bf 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -262,6 +262,12 @@ extern const TargetPageBits target_page;
 #define PAGE_TARGET_1  0x0200
 #define PAGE_TARGET_2  0x0400
 
+/*
+ * For linux-user, indicates that the page is mapped with the same semantics
+ * in both guest and host.
+ */
+#define PAGE_PASSTHROUGH 0x0800
+
 #if defined(CONFIG_USER_ONLY)
 void page_dump(FILE *f);