mm/vmscan: inactive_list_is_low() to work on both file and anon lru lists

Submitted by Konstantin Khorenko on March 30, 2019, 8:04 a.m.

Details

Message ID 20190330080428.28286-1-khorenko@virtuozzo.com
State New
Series "mm/vmscan: inactive_list_is_low() to work on both file and anon lru lists"
Headers show

Commit Message

Konstantin Khorenko March 30, 2019, 8:04 a.m.
From: Andrey Ryabinin <aryabinin@virtuozzo.com>

At the moment inactive_list_is_low() mistakenly checks FILE list
whatever (file or anon) list is asked to check.

Honor list type argument.

Fixes: 1f45c6c57160 ("mm/vmscan: active lru protection fixups.")
https://jira.sw.ru/browse/PSBM-92480

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 mm/vmscan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1f5f48dd3cf1..74d3e8c61cf7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2008,7 +2008,9 @@  static void shrink_active_list(unsigned long nr_to_scan,
 static int inactive_list_is_low(struct lruvec *lruvec, bool file,
 				struct mem_cgroup *memcg, bool actual_reclaim)
 {
+	enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE;
 	struct zone *zone = lruvec_zone(lruvec);
+	enum lru_list inactive_lru = file * LRU_FILE;
 	unsigned long inactive_ratio;
 	unsigned long inactive;
 	unsigned long active;
@@ -2022,8 +2024,8 @@  static int inactive_list_is_low(struct lruvec *lruvec, bool file,
 	if (!file && !total_swap_pages)
 		return false;
 
-	inactive = lruvec_lru_size(lruvec, LRU_INACTIVE_FILE);
-	active = lruvec_lru_size(lruvec, LRU_ACTIVE_FILE);
+	inactive = lruvec_lru_size(lruvec, inactive_lru);
+	active = lruvec_lru_size(lruvec, active_lru);
 
 	if (memcg)
 		refaults = memcg_ws_activates(memcg);

Comments

Andrey Ryabinin April 1, 2019, 8:39 a.m.
On 3/30/19 11:04 AM, Konstantin Khorenko wrote:
> From: Andrey Ryabinin <aryabinin@virtuozzo.com>
> 
> At the moment inactive_list_is_low() mistakenly checks FILE list
> whatever (file or anon) list is asked to check.
> 
> Honor list type argument.
> 
> Fixes: 1f45c6c57160 ("mm/vmscan: active lru protection fixups.")
> https://jira.sw.ru/browse/PSBM-92480
> 

Fixes: bd24af0d6d08052165b43883213f564833de06e5 ("ms/mm: workingset: per-cgroup cache thrash detection")



> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Acked-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
>  mm/vmscan.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 1f5f48dd3cf1..74d3e8c61cf7 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2008,7 +2008,9 @@ static void shrink_active_list(unsigned long nr_to_scan,
>  static int inactive_list_is_low(struct lruvec *lruvec, bool file,
>  				struct mem_cgroup *memcg, bool actual_reclaim)
>  {
> +	enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE;
>  	struct zone *zone = lruvec_zone(lruvec);
> +	enum lru_list inactive_lru = file * LRU_FILE;
>  	unsigned long inactive_ratio;
>  	unsigned long inactive;
>  	unsigned long active;
> @@ -2022,8 +2024,8 @@ static int inactive_list_is_low(struct lruvec *lruvec, bool file,
>  	if (!file && !total_swap_pages)
>  		return false;
>  
> -	inactive = lruvec_lru_size(lruvec, LRU_INACTIVE_FILE);
> -	active = lruvec_lru_size(lruvec, LRU_ACTIVE_FILE);
> +	inactive = lruvec_lru_size(lruvec, inactive_lru);
> +	active = lruvec_lru_size(lruvec, active_lru);
>  
>  	if (memcg)
>  		refaults = memcg_ws_activates(memcg);
>