FROMGIT: BACKPORT: Multi-gen LRU: Fix can_swap in lru_gen_look_around()
walk->can_swap might be invalid since it's not guaranteed to be initialized for the particular lruvec. Instead deduce it from the folio type (anon/file). Link: https://lkml.kernel.org/r/20230802025606.346758-3-kaleshsingh@google.com Fixes: 018ee47f1489 ("mm: multi-gen LRU: exploit locality in rmap") Change-Id: I1ae78011d4972d87bac9f2db8c56352cdb7a9be6 Signed-off-by: Kalesh Singh <kaleshsingh@google.com> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> [mediatek] Tested-by: Charan Teja Kalla <quic_charante@quicinc.com> Cc: Yu Zhao <yuzhao@google.com> Cc: Aneesh Kumar K V <aneesh.kumar@linux.ibm.com> Cc: Barry Song <baohua@kernel.org> Cc: Brian Geffon <bgeffon@google.com> Cc: Jan Alexander Steffens (heftig) <heftig@archlinux.org> Cc: Lecopzer Chen <lecopzer.chen@mediatek.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Oleksandr Natalenko <oleksandr@natalenko.name> Cc: Qi Zheng <zhengqi.arch@bytedance.com> Cc: Steven Barrett <steven@liquorix.net> Cc: Suleiman Souhlal <suleiman@google.com> Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commit fdf19e8c8f1cdcee4eccf4c98a875f44f39d8b9d https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable) Bug: 288383787 Bug: 291719697 [ Kalesh Singh - Fix trivial conflict in lru_gen_look_around() ] Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
@@ -4416,6 +4416,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
|
||||
int young = 0;
|
||||
unsigned long bitmap[BITS_TO_LONGS(MIN_LRU_BATCH)] = {};
|
||||
struct page *page = pvmw->page;
|
||||
bool can_swap = !page_is_file_lru(page);
|
||||
struct mem_cgroup *memcg = page_memcg(page);
|
||||
struct pglist_data *pgdat = page_pgdat(page);
|
||||
struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat);
|
||||
@@ -4460,7 +4461,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
|
||||
if (!pte_young(pte[i]))
|
||||
continue;
|
||||
|
||||
page = get_pfn_page(pfn, memcg, pgdat, !walk || walk->can_swap);
|
||||
page = get_pfn_page(pfn, memcg, pgdat, can_swap);
|
||||
if (!page)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user