summaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 00bad7793788..a8ab1fc0e9bc 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1361,10 +1361,26 @@ static inline void dec_mm_counter(struct mm_struct *mm, int member)
1361 atomic_long_dec(&mm->rss_stat.count[member]); 1361 atomic_long_dec(&mm->rss_stat.count[member]);
1362} 1362}
1363 1363
1364/* Optimized variant when page is already known not to be PageAnon */
1365static inline int mm_counter_file(struct page *page)
1366{
1367 if (PageSwapBacked(page))
1368 return MM_SHMEMPAGES;
1369 return MM_FILEPAGES;
1370}
1371
1372static inline int mm_counter(struct page *page)
1373{
1374 if (PageAnon(page))
1375 return MM_ANONPAGES;
1376 return mm_counter_file(page);
1377}
1378
1364static inline unsigned long get_mm_rss(struct mm_struct *mm) 1379static inline unsigned long get_mm_rss(struct mm_struct *mm)
1365{ 1380{
1366 return get_mm_counter(mm, MM_FILEPAGES) + 1381 return get_mm_counter(mm, MM_FILEPAGES) +
1367 get_mm_counter(mm, MM_ANONPAGES); 1382 get_mm_counter(mm, MM_ANONPAGES) +
1383 get_mm_counter(mm, MM_SHMEMPAGES);
1368} 1384}
1369 1385
1370static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm) 1386static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)