]> git.baikalelectronics.ru Git - kernel.git/commitdiff
proc: optimise smaps for shmem entries
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 13 Oct 2020 23:51:28 +0000 (16:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Oct 2020 01:38:29 +0000 (18:38 -0700)
Avoid bumping the refcount on pages when we're only interested in the
swap entries.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Link: https://lkml.kernel.org/r/20200910183318.20139-5-willy@infradead.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/task_mmu.c

index 35172a91148e5eec19e88661287f433d67b8b513..a1be198f755c3afb23df6849fabc779cdf2d7745 100644 (file)
@@ -520,16 +520,10 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
                        page = device_private_entry_to_page(swpent);
        } else if (unlikely(IS_ENABLED(CONFIG_SHMEM) && mss->check_shmem_swap
                                                        && pte_none(*pte))) {
-               page = find_get_entry(vma->vm_file->f_mapping,
+               page = xa_load(&vma->vm_file->f_mapping->i_pages,
                                                linear_page_index(vma, addr));
-               if (!page)
-                       return;
-
                if (xa_is_value(page))
                        mss->swap += PAGE_SIZE;
-               else
-                       put_page(page);
-
                return;
        }