lkml.org 
[lkml]   [2019]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/9] kmemleak: correctly check for kthreads
Date
In general, a non-NULL current->mm doesn't imply that current is a
kthread, as kthreads can install an mm via use_mm(), and so it's
preferable to use is_kthread() to determine whether a thread is a
kthread.

For consistency, let's use is_kthread() here.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---
mm/kmemleak.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 6e9e8cca663e..42ea3c14b577 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1290,10 +1290,10 @@ static int scan_should_stop(void)
* This function may be called from either process or kthread context,
* hence the need to check for both stop conditions.
*/
- if (current->mm)
- return signal_pending(current);
- else
+ if (is_kthread(current))
return kthread_should_stop();
+ else
+ return signal_pending(current);

return 0;
}
--
2.11.0
\
 
 \ /
  Last update: 2019-08-14 12:43    [W:1.691 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site