hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/mm_inline.h
....@@ -4,21 +4,26 @@
44
55 #include <linux/huge_mm.h>
66 #include <linux/swap.h>
7
+#ifndef __GENKSYMS__
8
+#define PROTECT_TRACE_INCLUDE_PATH
9
+#include <trace/hooks/mm.h>
10
+#endif
711
812 /**
9
- * page_is_file_cache - should the page be on a file LRU or anon LRU?
13
+ * page_is_file_lru - should the page be on a file LRU or anon LRU?
1014 * @page: the page to test
1115 *
12
- * Returns 1 if @page is page cache page backed by a regular filesystem,
13
- * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
14
- * Used by functions that manipulate the LRU lists, to sort a page
15
- * onto the right LRU list.
16
+ * Returns 1 if @page is a regular filesystem backed page cache page or a lazily
17
+ * freed anonymous page (e.g. via MADV_FREE). Returns 0 if @page is a normal
18
+ * anonymous page, a tmpfs page or otherwise ram or swap backed page. Used by
19
+ * functions that manipulate the LRU lists, to sort a page onto the right LRU
20
+ * list.
1621 *
1722 * We would like to get this info without a page flag, but the state
1823 * needs to survive until the page is last deleted from the LRU, which
1924 * could be as far down as __page_cache_release.
2025 */
21
-static inline int page_is_file_cache(struct page *page)
26
+static inline int page_is_file_lru(struct page *page)
2227 {
2328 return !PageSwapBacked(page);
2429 }
....@@ -29,7 +34,7 @@
2934 {
3035 struct pglist_data *pgdat = lruvec_pgdat(lruvec);
3136
32
- __mod_node_page_state(pgdat, NR_LRU_BASE + lru, nr_pages);
37
+ __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages);
3338 __mod_zone_page_state(&pgdat->node_zones[zid],
3439 NR_ZONE_LRU_BASE + lru, nr_pages);
3540 }
....@@ -47,22 +52,25 @@
4752 static __always_inline void add_page_to_lru_list(struct page *page,
4853 struct lruvec *lruvec, enum lru_list lru)
4954 {
50
- update_lru_size(lruvec, lru, page_zonenum(page), hpage_nr_pages(page));
55
+ trace_android_vh_add_page_to_lrulist(page, false, lru);
56
+ update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page));
5157 list_add(&page->lru, &lruvec->lists[lru]);
5258 }
5359
5460 static __always_inline void add_page_to_lru_list_tail(struct page *page,
5561 struct lruvec *lruvec, enum lru_list lru)
5662 {
57
- update_lru_size(lruvec, lru, page_zonenum(page), hpage_nr_pages(page));
63
+ trace_android_vh_add_page_to_lrulist(page, false, lru);
64
+ update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page));
5865 list_add_tail(&page->lru, &lruvec->lists[lru]);
5966 }
6067
6168 static __always_inline void del_page_from_lru_list(struct page *page,
6269 struct lruvec *lruvec, enum lru_list lru)
6370 {
71
+ trace_android_vh_del_page_from_lrulist(page, false, lru);
6472 list_del(&page->lru);
65
- update_lru_size(lruvec, lru, page_zonenum(page), -hpage_nr_pages(page));
73
+ update_lru_size(lruvec, lru, page_zonenum(page), -thp_nr_pages(page));
6674 }
6775
6876 /**
....@@ -75,7 +83,7 @@
7583 */
7684 static inline enum lru_list page_lru_base_type(struct page *page)
7785 {
78
- if (page_is_file_cache(page))
86
+ if (page_is_file_lru(page))
7987 return LRU_INACTIVE_FILE;
8088 return LRU_INACTIVE_ANON;
8189 }
....@@ -124,7 +132,4 @@
124132 }
125133 return lru;
126134 }
127
-
128
-#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
129
-
130135 #endif