lkml.org 
[lkml]   [2022]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 18/21] gup: add FOLL_HINT_BULK, FAULT_FLAG_NON_CACHING
    Date
    Add FOLL_HINT_BULK, which callers of get_user_pages(), pin_user_pages()
    can use to signal that this call is one of many, allowing
    get_user_pages() to optimize accordingly.

    Additionally, add FAULT_FLAG_NON_CACHING, which in the fault handling
    path signals that the underlying logic can use non-caching primitives.
    This is a possible optimization for FOLL_HINT_BULK calls.

    Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
    ---
    include/linux/mm.h | 1 +
    include/linux/mm_types.h | 2 ++
    2 files changed, 3 insertions(+)

    diff --git a/include/linux/mm.h b/include/linux/mm.h
    index a9b0c1889348..dbd8b7344dfc 100644
    --- a/include/linux/mm.h
    +++ b/include/linux/mm.h
    @@ -2941,6 +2941,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
    #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_HINT_BULK 0x100000 /* part of a larger extent being gup'd */

    /*
    * FOLL_PIN and FOLL_LONGTERM may be used in various combinations with each
    diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
    index b34ff2cdbc4f..287b3018c14d 100644
    --- a/include/linux/mm_types.h
    +++ b/include/linux/mm_types.h
    @@ -824,6 +824,7 @@ typedef struct {
    * mapped R/O.
    * @FAULT_FLAG_ORIG_PTE_VALID: whether the fault has vmf->orig_pte cached.
    * We should only access orig_pte if this flag set.
    + * @FAULT_FLAG_NON_CACHING: Avoid polluting the cache if possible.
    *
    * About @FAULT_FLAG_ALLOW_RETRY and @FAULT_FLAG_TRIED: we can specify
    * whether we would allow page faults to retry by specifying these two
    @@ -861,6 +862,7 @@ enum fault_flag {
    FAULT_FLAG_INTERRUPTIBLE = 1 << 9,
    FAULT_FLAG_UNSHARE = 1 << 10,
    FAULT_FLAG_ORIG_PTE_VALID = 1 << 11,
    + FAULT_FLAG_NON_CACHING = 1 << 12,
    };

    typedef unsigned int __bitwise zap_flags_t;
    --
    2.31.1
    \
     
     \ /
      Last update: 2022-06-06 22:47    [W:4.812 / U:0.576 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site