proc: convert smaps_page_accumulate to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 3 Apr 2024 17:14:53 +0000 (18:14 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Apr 2024 03:56:35 +0000 (20:56 -0700)
Replaces three calls to compound_head() with one.  Shrinks the function
from 2614 bytes to 1112 bytes in an allmodconfig build.

Link: https://lkml.kernel.org/r/20240403171456.1445117-3-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/task_mmu.c

index 5260a2788f748c609888b4dd0cd7f0e9d6ef6bbb..2a3133dd47b1d88a1abfb5474c45ec0f102e5b7f 100644 (file)
@@ -414,11 +414,12 @@ static void smaps_page_accumulate(struct mem_size_stats *mss,
                struct page *page, unsigned long size, unsigned long pss,
                bool dirty, bool locked, bool private)
 {
+       struct folio *folio = page_folio(page);
        mss->pss += pss;
 
-       if (PageAnon(page))
+       if (folio_test_anon(folio))
                mss->pss_anon += pss;
-       else if (PageSwapBacked(page))
+       else if (folio_test_swapbacked(folio))
                mss->pss_shmem += pss;
        else
                mss->pss_file += pss;
@@ -426,7 +427,7 @@ static void smaps_page_accumulate(struct mem_size_stats *mss,
        if (locked)
                mss->pss_locked += pss;
 
-       if (dirty || PageDirty(page)) {
+       if (dirty || folio_test_dirty(folio)) {
                mss->pss_dirty += pss;
                if (private)
                        mss->private_dirty += size;