mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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: 018ee47f14
("mm: multi-gen LRU: exploit locality in rmap")
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>
This commit is contained in:
parent
bb5e7f234e
commit
a3235ea2a8
1 changed files with 2 additions and 1 deletions
|
@ -4656,6 +4656,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
|
||||||
pte_t *pte = pvmw->pte;
|
pte_t *pte = pvmw->pte;
|
||||||
unsigned long addr = pvmw->address;
|
unsigned long addr = pvmw->address;
|
||||||
struct folio *folio = pfn_folio(pvmw->pfn);
|
struct folio *folio = pfn_folio(pvmw->pfn);
|
||||||
|
bool can_swap = !folio_is_file_lru(folio);
|
||||||
struct mem_cgroup *memcg = folio_memcg(folio);
|
struct mem_cgroup *memcg = folio_memcg(folio);
|
||||||
struct pglist_data *pgdat = folio_pgdat(folio);
|
struct pglist_data *pgdat = folio_pgdat(folio);
|
||||||
struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat);
|
struct lruvec *lruvec = mem_cgroup_lruvec(memcg, pgdat);
|
||||||
|
@ -4704,7 +4705,7 @@ void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
|
||||||
if (!pte_young(ptent))
|
if (!pte_young(ptent))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
folio = get_pfn_folio(pfn, memcg, pgdat, !walk || walk->can_swap);
|
folio = get_pfn_folio(pfn, memcg, pgdat, can_swap);
|
||||||
if (!folio)
|
if (!folio)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue