• D
    mm/memory.c: add apply_to_existing_page_range() helper · be1db475
    Daniel Axtens 提交于
    apply_to_page_range() takes an address range, and if any parts of it are
    not covered by the existing page table hierarchy, it allocates memory to
    fill them in.
    
    In some use cases, this is not what we want - we want to be able to
    operate exclusively on PTEs that are already in the tables.
    
    Add apply_to_existing_page_range() for this.  Adjust the walker
    functions for apply_to_page_range to take 'create', which switches them
    between the old and new modes.
    
    This will be used in KASAN vmalloc.
    
    [akpm@linux-foundation.org: reduce code duplication]
    [akpm@linux-foundation.org: s/apply_to_existing_pages/apply_to_existing_page_range/]
    [akpm@linux-foundation.org: initialize __apply_to_page_range::err]
    Link: http://lkml.kernel.org/r/20191205140407.1874-1-dja@axtens.netSigned-off-by: NDaniel Axtens <dja@axtens.net>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Daniel Axtens <dja@axtens.net>
    Cc: Qian Cai <cai@lca.pw>
    Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    be1db475
mm.h 88.9 KB