On Mon, 26 Mar 2018 12:26:11 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > It looks fine to me. Maybe Andrew can pick it up. > > > > Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx> > > Well, the comment says: > > /* > * Stop the automatic memory scanning thread. This function must be called > * with the scan_mutex held. > */ > static void stop_scan_thread(void) > > > So shouldn't we do it this way? If "yes" then could someone please runtime test this? > --- a/mm/kmemleak.c~mm-kmemleak-wait-for-scan-completion-before-disabling-free-fix > +++ a/mm/kmemleak.c > @@ -1919,9 +1919,9 @@ static void __kmemleak_do_cleanup(void) > */ > static void kmemleak_do_cleanup(struct work_struct *work) > { > + mutex_lock(&scan_mutex); > stop_scan_thread(); > > - mutex_lock(&scan_mutex); > /* > * Once it is made sure that kmemleak_scan has stopped, it is safe to no > * longer track object freeing. Ordering of the scan thread stopping and > _ >