Message ID | 20220409093500.10329-5-linmiaohe@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | A few cleanup and fixup patches for vmscan | expand |
On Sat, 2022-04-09 at 17:34 +0800, Miaohe Lin wrote: > LRU_UNEVICTABLE is not taken into account when shrink lruvec. So we can > save a bit of stack space by shrinking the array size of nr and targets > to NR_LRU_LISTS - 1. No functional change intended. > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> > --- > mm/vmscan.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 59b96320f481..0e5818970998 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2881,8 +2881,9 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, > > > static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) > { > - unsigned long nr[NR_LRU_LISTS]; > - unsigned long targets[NR_LRU_LISTS]; > + /* LRU_UNEVICTABLE is not taken into account. */ > + unsigned long nr[NR_LRU_LISTS - 1]; > + unsigned long targets[NR_LRU_LISTS - 1]; > unsigned long nr_to_scan; > enum lru_list lru; > unsigned long nr_reclaimed = 0; As Christoph pointed out, this is hacky without much benefit. Please drop this patch. Best Regards, Huang, Ying
On 2022/4/12 8:57, ying.huang@intel.com wrote: > On Sat, 2022-04-09 at 17:34 +0800, Miaohe Lin wrote: >> LRU_UNEVICTABLE is not taken into account when shrink lruvec. So we can >> save a bit of stack space by shrinking the array size of nr and targets >> to NR_LRU_LISTS - 1. No functional change intended. >> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> >> --- >> mm/vmscan.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/mm/vmscan.c b/mm/vmscan.c >> index 59b96320f481..0e5818970998 100644 >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c >> @@ -2881,8 +2881,9 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, >> >> >> static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) >> { >> - unsigned long nr[NR_LRU_LISTS]; >> - unsigned long targets[NR_LRU_LISTS]; >> + /* LRU_UNEVICTABLE is not taken into account. */ >> + unsigned long nr[NR_LRU_LISTS - 1]; >> + unsigned long targets[NR_LRU_LISTS - 1]; >> unsigned long nr_to_scan; >> enum lru_list lru; >> unsigned long nr_reclaimed = 0; > > As Christoph pointed out, this is hacky without much benefit. Please > drop this patch. Will drop this patch. Thanks. > > Best Regards, > Huang, Ying > > . >
diff --git a/mm/vmscan.c b/mm/vmscan.c index 59b96320f481..0e5818970998 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2881,8 +2881,9 @@ static bool can_age_anon_pages(struct pglist_data *pgdat, static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) { - unsigned long nr[NR_LRU_LISTS]; - unsigned long targets[NR_LRU_LISTS]; + /* LRU_UNEVICTABLE is not taken into account. */ + unsigned long nr[NR_LRU_LISTS - 1]; + unsigned long targets[NR_LRU_LISTS - 1]; unsigned long nr_to_scan; enum lru_list lru; unsigned long nr_reclaimed = 0;
LRU_UNEVICTABLE is not taken into account when shrink lruvec. So we can save a bit of stack space by shrinking the array size of nr and targets to NR_LRU_LISTS - 1. No functional change intended. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/vmscan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)