xhci: support new USB 3.1 hub request to get extended port status
[deliverable/linux.git] / fs / proc / task_mmu.c
index 67c76468a7be4a057d42f1c2b1ca50ec851cb3d7..e2d46adb54b42a76608a0cbf938d55529bd6c851 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/swap.h>
 #include <linux/swapops.h>
 #include <linux/mmu_notifier.h>
+#include <linux/page_idle.h>
 
 #include <asm/elf.h>
 #include <asm/uaccess.h>
@@ -446,6 +447,7 @@ struct mem_size_stats {
        unsigned long anonymous_thp;
        unsigned long swap;
        u64 pss;
+       u64 swap_pss;
 };
 
 static void smaps_account(struct mem_size_stats *mss, struct page *page,
@@ -458,7 +460,7 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
 
        mss->resident += size;
        /* Accumulate the size in pages that have been accessed. */
-       if (young || PageReferenced(page))
+       if (young || page_is_young(page) || PageReferenced(page))
                mss->referenced += size;
        mapcount = page_mapcount(page);
        if (mapcount >= 2) {
@@ -492,9 +494,20 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr,
        } else if (is_swap_pte(*pte)) {
                swp_entry_t swpent = pte_to_swp_entry(*pte);
 
-               if (!non_swap_entry(swpent))
+               if (!non_swap_entry(swpent)) {
+                       int mapcount;
+
                        mss->swap += PAGE_SIZE;
-               else if (is_migration_entry(swpent))
+                       mapcount = swp_swapcount(swpent);
+                       if (mapcount >= 2) {
+                               u64 pss_delta = (u64)PAGE_SIZE << PSS_SHIFT;
+
+                               do_div(pss_delta, mapcount);
+                               mss->swap_pss += pss_delta;
+                       } else {
+                               mss->swap_pss += (u64)PAGE_SIZE << PSS_SHIFT;
+                       }
+               } else if (is_migration_entry(swpent))
                        page = migration_entry_to_page(swpent);
        }
 
@@ -640,6 +653,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
                   "Anonymous:      %8lu kB\n"
                   "AnonHugePages:  %8lu kB\n"
                   "Swap:           %8lu kB\n"
+                  "SwapPss:        %8lu kB\n"
                   "KernelPageSize: %8lu kB\n"
                   "MMUPageSize:    %8lu kB\n"
                   "Locked:         %8lu kB\n",
@@ -654,6 +668,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
                   mss.anonymous >> 10,
                   mss.anonymous_thp >> 10,
                   mss.swap >> 10,
+                  (unsigned long)(mss.swap_pss >> (10 + PSS_SHIFT)),
                   vma_kernel_pagesize(vma) >> 10,
                   vma_mmu_pagesize(vma) >> 10,
                   (vma->vm_flags & VM_LOCKED) ?
@@ -793,6 +808,7 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
 
                /* Clear accessed and referenced bits. */
                pmdp_test_and_clear_young(vma, addr, pmd);
+               test_and_clear_page_young(page);
                ClearPageReferenced(page);
 out:
                spin_unlock(ptl);
@@ -820,6 +836,7 @@ out:
 
                /* Clear accessed and referenced bits. */
                ptep_test_and_clear_young(vma, addr, pte);
+               test_and_clear_page_young(page);
                ClearPageReferenced(page);
        }
        pte_unmap_unlock(pte - 1, ptl);
This page took 0.029237 seconds and 5 git commands to generate.