Re: [PATCH 1/2] mm/kmemleak: Simplify kmemleak_cond_resched() usage

From: Catalin Marinas
Date: Wed Dec 14 2022 - 05:43:26 EST


On Sat, Dec 10, 2022 at 06:00:47PM -0500, Waiman Long wrote:
> The presence of a pinned argument and the 64k loop count make
> kmemleak_cond_resched() a bit more complex to read. The pinned argument
> is used only by first kmemleak_scan() loop.
>
> Simplify the usage of kmemleak_cond_resched() by removing the pinned
> argument and always do a get_object()/put_object() sequence. In
> addition, the 64k loop is removed by using need_resched() to decide if
> kmemleak_cond_resched() should be called.

Not sure why we ended up with the 'pinned' argument, get/put_object()
can be nested.

Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>