[PATCH 31/75] mm: Add lru_to_folio()

From: Matthew Wilcox (Oracle)
Date: Fri Feb 04 2022 - 14:59:08 EST


Since page->lru occupies the same bytes as compound_head, any page
on the LRU list must be a folio.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
include/linux/mm.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3ca6dea4fe4a..6cb2651eccbe 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -229,6 +229,7 @@ int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *,
#define PAGE_ALIGNED(addr) IS_ALIGNED((unsigned long)(addr), PAGE_SIZE)

#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
+#define lru_to_folio(head) (list_entry((head)->prev, struct folio, lru))

void setup_initial_init_mm(void *start_code, void *end_code,
void *end_data, void *brk);
--
2.34.1