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>
diff --git a/include/linux/mm.h b/include/linux/mm.h index 46ce49b..95eb99e 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: