aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2021-01-26 23:19:39 -0500
committerAndrea Arcangeli <aarcange@redhat.com>2023-11-11 22:03:36 -0500
commit8c61820016b3b4265b1edfb2df0a8cee3c2a889a (patch)
tree996c48e0aae1bca14594cc420b7f6c002cdfc557
parent15e716f10a34ddea184eaf4c2e2c19a13b981b2b (diff)
downloadaa-8c61820016b3b4265b1edfb2df0a8cee3c2a889a.tar.gz
mm: gup: enable FOLL_MM_SYNC by default for FOLL_LONGTERM
Drivers that for whatever reason can risk to lose coherency with the MM after taking readonly long term pins (as result of later COW faults), can specify __FOLL_LONGTERM to opt-out from FOLL_MM_SYNC. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
-rw-r--r--include/linux/mm.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 46ce49b9189c8e..95eb99ec1d4f03 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2873,13 +2873,15 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
#define FOLL_REMOTE 0x2000 /* we are working on non-current tsk/mm */
#define FOLL_COW 0x4000 /* internal GUP flag */
#define FOLL_ANON 0x8000 /* don't do file mappings */
-#define FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */
+#define __FOLL_LONGTERM 0x10000 /* mapping lifetime is indefinite: see below */
#define FOLL_SPLIT_PMD 0x20000 /* split huge pmd before returning */
#define FOLL_PIN 0x40000 /* pages must be released via unpin_user_page */
#define FOLL_FAST_ONLY 0x80000 /* gup_fast: prevent fall-back to slow gup */
#define FOLL_NOUNSHARE 0x100000 /* gup: don't trigger a COR fault */
#define FOLL_MM_SYNC 0x200000/* gup: long term mm coherency to page pins */
+#define FOLL_LONGTERM (FOLL_MM_SYNC|__FOLL_LONGTERM)
+
/*
* FOLL_PIN and FOLL_LONGTERM may be used in various combinations with each
* other. Here is what they mean, and how to use them: