mm/mglru: restore accidentally removed seq < max_seq check
Subsystems (3)
Barry Song (Xiaomi)
reviewerPATCH 1/1 mm/mglru: restore accidentally removed seq < max_seq check
Since commit 798c0330c2ca ("mm/mglru: rework aging feedback"), the following sanity check was accidentally removed:
if (seq < max_seq)
return 0;
That means we can perform aging for any value less than or equal to max_gen_nr.
This has been inconsistent with Documentation/admin-guide/mm/multigen_lru.rst, which states:
Users can write the following command to ``lru_gen`` to create a new generation ``max_gen_nr+1``:
``+ memcg_id node_id max_gen_nr [can_swap [force_scan]]``
The correct semantics are that writing a value smaller than max_gen_nr should return 0, since the requested generation already exists.
--- mm/vmscan.c | 3 +++ 1 file changed, 3 insertions(+)
mm/vmscan.c +3 -0
@@ -5827,6 +5827,9 @@ static int run_aging(struct lruvec *lruvec, unsigned long seq, {DEFINE_MAX_SEQ (lruvec); +if (seq < max_seq) +return 0 ; +if (seq > max_seq)return -EINVAL ;
Signature · 1 line
2.39.3 (Apple Git-146)
Quoted 16 lines · Barry Song (Xiaomi)
Since commit
798c0330c2ca("mm/mglru: rework aging feedback"), the following sanity check was accidentally removed:
if (seq <max_seq)
return 0;That means we can perform aging for any value less than or equal to
max_gen_nr.This has been inconsistent with
Documentation/admin-guide/mm/multigen_lru.rst, which states:Users can write the following command to ``lru_gen`` to create a new generation ``max_gen_nr+1``:
``+ memcg_id node_id max_gen_nr [can_swap [force_scan]]``
Quoted 8 lines
The correct semantics are that writing a value smaller than
max_gen_nrshould return 0, since the requested generation already exists.Fixes 798c0330c2ca ("mm/mglru: rework aging feedback")Reported-by Chuanhua Han <[email protected]>Signed-off-by Barry Song (Xiaomi) <[email protected]>---
LGTM.
Quoted 33 lines · Barry Song (Xiaomi)
Since commit
798c0330c2ca("mm/mglru: rework aging feedback"), the following sanity check was accidentally removed:
if (seq <max_seq)
return 0;That means we can perform aging for any value less than or equal to
max_gen_nr.This has been inconsistent with
Documentation/admin-guide/mm/multigen_lru.rst, which states:Users can write the following command to ``lru_gen`` to create a new generation ``max_gen_nr+1``:
``+ memcg_id node_id max_gen_nr [can_swap [force_scan]]``The correct semantics are that writing a value smaller than
max_gen_nrshould return 0, since the requested generation already exists.Fixes 798c0330c2ca ("mm/mglru: rework aging feedback")Reported-by Chuanhua Han <[email protected]>Signed-off-by Barry Song (Xiaomi) <[email protected]>--- mm/vmscan.c | 3 +++ 1 file changed, 3 insertions(+)mm/vmscan.c +0
-0
mm/vmscan.c static int run_aging(struct lruvec *lruvec, unsigned long seq, · line 5834
Quoted 8 lines
mm/vmscan.c +3
-0@@ -5827,6 +5827,9 @@ static int run_aging(struct lruvec *lruvec, unsigned long seq, {DEFINE_MAX_SEQ (lruvec); +if (seq < max_seq) +return 0 ; +if (seq > max_seq)return -EINVAL ;