lkml.org 
[lkml]   [2023]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 01/18] mm: add mm_counter_folio() and mm_counter_file_folio()
Date
Introduce two mm counter folio functions mm_counter_folio() and
mm_counter_file_folio(), will be used folio conversion, and it
saves a compound_head() in mm_counter().

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
include/linux/mm.h | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index caf13e94260e..f5f76504b212 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2583,19 +2583,29 @@ static inline void dec_mm_counter(struct mm_struct *mm, int member)
mm_trace_rss_stat(mm, member);
}

-/* Optimized variant when page is already known not to be PageAnon */
-static inline int mm_counter_file(struct page *page)
+static inline int mm_counter_file_folio(struct folio *folio)
{
- if (PageSwapBacked(page))
+ if (folio_test_swapbacked(folio))
return MM_SHMEMPAGES;
return MM_FILEPAGES;
}

-static inline int mm_counter(struct page *page)
+/* Optimized variant when page is already known not to be PageAnon */
+static inline int mm_counter_file(struct page *page)
+{
+ return mm_counter_file_folio(page_folio(page));
+}
+
+static inline int mm_counter_folio(struct folio *folio)
{
- if (PageAnon(page))
+ if (folio_test_anon(folio))
return MM_ANONPAGES;
- return mm_counter_file(page);
+ return mm_counter_file_folio(folio);
+}
+
+static inline int mm_counter(struct page *page)
+{
+ return mm_counter_folio(page_folio(page));
}

static inline unsigned long get_mm_rss(struct mm_struct *mm)
--
2.27.0
\
 
 \ /
  Last update: 2023-11-20 13:47    [W:0.129 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site