Commit cfc96da4 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton
Browse files

proc: convert smaps_page_accumulate to use a folio

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: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f1dc623f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;