On Fri, Feb 04, 2022 at 07:58:08PM +0000, Matthew Wilcox (Oracle) wrote: > Since page->lru occupies the same bytes as compound_head, any page > on the LRU list must be a folio. Any reason to not turn this into an inline function?
On Sun, Feb 06, 2022 at 11:50:06PM -0800, Christoph Hellwig wrote: > On Fri, Feb 04, 2022 at 07:58:08PM +0000, Matthew Wilcox (Oracle) wrote: > > Since page->lru occupies the same bytes as compound_head, any page > > on the LRU list must be a folio. > > Any reason to not turn this into an inline function? Good idea. Done.
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);
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@infradead.org> --- include/linux/mm.h | 1 + 1 file changed, 1 insertion(+)