[Devel] [PATCH rh7 2/2] mm/vmscan: add cond_resched() to loop in shrink_slab_memcg()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Feb 2 12:29:57 MSK 2021


On 01.02.2021 17:10, Andrey Ryabinin wrote:
> shrink_slab_memcg() may iterate for a long time without resched if we
> have many memcg with small amount of objects. Add cond_resched() to
> avoid potential softlockup.
> 
> https://jira.sw.ru/browse/PSBM-125095
> Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>

> ---
>  mm/vmscan.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 080500f4e366..17a7ed60f525 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -527,6 +527,8 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid,
>  		struct shrinker *shrinker;
>  		bool is_nfs;
>  
> +		cond_resched();
> +
>  		shrinker = idr_find(&shrinker_idr, i);
>  		if (unlikely(!shrinker)) {
>  			clear_bit(i, map->map);
> 



More information about the Devel mailing list