Commit 27bb0a70 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

proc: pass a folio to smaps_page_accumulate()

Both callers already have a folio; pass it in instead of doing the
conversion each time.

Link: https://lkml.kernel.org/r/20240403171456.1445117-4-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent cfc96da4
...@@ -411,10 +411,9 @@ struct mem_size_stats { ...@@ -411,10 +411,9 @@ struct mem_size_stats {
}; };
static void smaps_page_accumulate(struct mem_size_stats *mss, static void smaps_page_accumulate(struct mem_size_stats *mss,
struct page *page, unsigned long size, unsigned long pss, struct folio *folio, unsigned long size, unsigned long pss,
bool dirty, bool locked, bool private) bool dirty, bool locked, bool private)
{ {
struct folio *folio = page_folio(page);
mss->pss += pss; mss->pss += pss;
if (folio_test_anon(folio)) if (folio_test_anon(folio))
...@@ -484,8 +483,8 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, ...@@ -484,8 +483,8 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
* as mapcount == 1. * as mapcount == 1.
*/ */
if ((folio_ref_count(folio) == 1) || migration) { if ((folio_ref_count(folio) == 1) || migration) {
smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, smaps_page_accumulate(mss, folio, size, size << PSS_SHIFT,
locked, true); dirty, locked, true);
return; return;
} }
for (i = 0; i < nr; i++, page++) { for (i = 0; i < nr; i++, page++) {
...@@ -493,8 +492,8 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, ...@@ -493,8 +492,8 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page,
unsigned long pss = PAGE_SIZE << PSS_SHIFT; unsigned long pss = PAGE_SIZE << PSS_SHIFT;
if (mapcount >= 2) if (mapcount >= 2)
pss /= mapcount; pss /= mapcount;
smaps_page_accumulate(mss, page, PAGE_SIZE, pss, dirty, locked, smaps_page_accumulate(mss, folio, PAGE_SIZE, pss,
mapcount < 2); dirty, locked, mapcount < 2);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment