• David Miller's avatar
    mm, perf_event: Make vmalloc_user() align base kernel virtual address to SHMLBA · 2dca6999
    David Miller authored
    When a vmalloc'd area is mmap'd into userspace, some kind of
    co-ordination is necessary for this to work on platforms with cpu
    D-caches which can have aliases.
    
    Otherwise kernel side writes won't be seen properly in userspace
    and vice versa.
    
    If the kernel side mapping and the user side one have the same
    alignment, modulo SHMLBA, this can work as long as VM_SHARED is
    shared of VMA and for all current users this is true.  VM_SHARED
    will force SHMLBA alignment of the user side mmap on platforms with
    D-cache aliasing matters.
    
    The bulk of this patch is just making it so that a specific
    alignment can be passed down into __get_vm_area_node().  All
    existing callers pass in '1' which preserves existing behavior.
    vmalloc_user() gives SHMLBA for the alignment.
    
    As a side effect this should get the video media drivers and other
    vmalloc_user() users into more working shape on such systems.
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Jens Axboe <jens.axboe@oracle.com>
    Cc: Nick Piggin <nickpiggin@yahoo.com.au>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    LKML-Reference: <200909211922.n8LJMYjw029425@imap1.linux-foundation.org>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    2dca6999
vmalloc.c 59.4 KB