• Ira Weiny's avatar
    mm/highmem: remove deprecated kmap_atomic · d2c20e51
    Ira Weiny authored
    kmap_atomic() is being deprecated in favor of kmap_local_page().
    
    Replace the uses of kmap_atomic() within the highmem code.
    
    On profiling clear_huge_page() using ftrace an improvement of 62% was
    observed on the below setup.
    
    Setup:-
    Below data has been collected on Qualcomm's SM7250 SoC THP enabled
    (kernel v4.19.113) with only CPU-0(Cortex-A55) and CPU-7(Cortex-A76)
    switched on and set to max frequency, also DDR set to perf governor.
    
    FTRACE Data:-
    
    Base data:-
    Number of iterations: 48
    Mean of allocation time: 349.5 us
    std deviation: 74.5 us
    
    v4 data:-
    Number of iterations: 48
    Mean of allocation time: 131 us
    std deviation: 32.7 us
    
    The following simple userspace experiment to allocate
    100MB(BUF_SZ) of pages and writing to it gave us a good insight,
    we observed an improvement of 42% in allocation and writing timings.
    -------------------------------------------------------------
    Test code snippet
    -------------------------------------------------------------
          clock_start();
          buf = malloc(BUF_SZ); /* Allocate 100 MB of memory */
    
            for(i=0; i < BUF_SZ_PAGES; i++)
            {
                    *((int *)(buf + (i*PAGE_SIZE))) = 1;
            }
          clock_end();
    -------------------------------------------------------------
    
    Malloc test timings for 100MB anon allocation:-
    
    Base data:-
    Number of iterations: 100
    Mean of allocation time: 31831 us
    std deviation: 4286 us
    
    v4 data:-
    Number of iterations: 100
    Mean of allocation time: 18193 us
    std deviation: 4915 us
    
    [willy@infradead.org: fix zero_user_segments()]
      Link: https://lkml.kernel.org/r/YYVhHCJcm2DM2G9u@casper.infradead.org
    
    Link: https://lkml.kernel.org/r/20210204073255.20769-2-prathu.baronia@oneplus.comSigned-off-by: default avatarIra Weiny <ira.weiny@intel.com>
    Signed-off-by: default avatarPrathu Baronia <prathu.baronia@oneplus.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    d2c20e51
highmem.h 8.97 KB