mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
mm: migrate LRU_REFS_MASK bits in folio_migrate_flags
Bits of LRU_REFS_MASK are not inherited during migration which lead to new folio start from tier0 when MGLRU enabled. Try to bring as much bits of folio->flags as possible since compaction and alloc_contig_range which introduce migration do happen at times. Link: https://lkml.kernel.org/r/20240926050647.5653-1-zhaoyang.huang@unisoc.com Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com> Suggested-by: Yu Zhao <yuzhao@google.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Yu Zhao <yuzhao@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
583e66debd
commit
473c371254
@ -291,6 +291,12 @@ static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio,
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void folio_migrate_refs(struct folio *new, struct folio *old)
|
||||
{
|
||||
unsigned long refs = READ_ONCE(old->flags) & LRU_REFS_MASK;
|
||||
|
||||
set_mask_bits(&new->flags, LRU_REFS_MASK, refs);
|
||||
}
|
||||
#else /* !CONFIG_LRU_GEN */
|
||||
|
||||
static inline bool lru_gen_enabled(void)
|
||||
@ -313,6 +319,10 @@ static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio,
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void folio_migrate_refs(struct folio *new, struct folio *old)
|
||||
{
|
||||
|
||||
}
|
||||
#endif /* CONFIG_LRU_GEN */
|
||||
|
||||
static __always_inline
|
||||
|
@ -695,6 +695,7 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio)
|
||||
if (folio_test_idle(folio))
|
||||
folio_set_idle(newfolio);
|
||||
|
||||
folio_migrate_refs(newfolio, folio);
|
||||
/*
|
||||
* Copy NUMA information to the new page, to prevent over-eager
|
||||
* future migrations of this same page.
|
||||
|
Loading…
Reference in New Issue
Block a user