All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] staging: lowmemorykiller: remove bogus NULL check
@ 2016-04-08 13:02 Dan Carpenter
  2016-04-09  0:52 ` Tetsuo Handa
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-08 13:02 UTC (permalink / raw)
  To: kernel-janitors

The NULL checking here doesn't make sense, so it causes a static checker
warning.  It turns out that p->mm can't be NULL so the inconsistency is
harmless and we should just remove the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index c79f224..24d2745 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -131,7 +131,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
 		if (!p)
 			continue;
 
-		if (task_lmk_waiting(p) && p->mm &&
+		if (task_lmk_waiting(p) &&
 		    time_before_eq(jiffies, lowmem_deathpending_timeout)) {
 			task_unlock(p);
 			rcu_read_unlock();

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] staging: lowmemorykiller: remove bogus NULL check
  2016-04-08 13:02 [patch] staging: lowmemorykiller: remove bogus NULL check Dan Carpenter
@ 2016-04-09  0:52 ` Tetsuo Handa
  0 siblings, 0 replies; 2+ messages in thread
From: Tetsuo Handa @ 2016-04-09  0:52 UTC (permalink / raw)
  To: kernel-janitors

Dan Carpenter wrote:
> The NULL checking here doesn't make sense, so it causes a static checker
> warning.  It turns out that p->mm can't be NULL so the inconsistency is
> harmless and we should just remove the check.

Commit 77ed2c5745d9 ("android,lowmemorykiller: Don't abuse TIF_MEMDIE.")
replaced test_tsk_thread_flag(p, TIF_MEMDIE) with task_lmk_waiting(p) && p->mm
because TIF_MEMDIE is cleared after p->mm became NULL whereas
PFA_LMK_WAITING is not cleared after p->mm became NULL.
But p is a thread which is guaranteed to be p->mm != NULL.

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

> 
> diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
> index c79f224..24d2745 100644
> --- a/drivers/staging/android/lowmemorykiller.c
> +++ b/drivers/staging/android/lowmemorykiller.c
> @@ -131,7 +131,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
>  		if (!p)
>  			continue;
>  
> -		if (task_lmk_waiting(p) && p->mm &&
> +		if (task_lmk_waiting(p) &&
>  		    time_before_eq(jiffies, lowmem_deathpending_timeout)) {
>  			task_unlock(p);
>  			rcu_read_unlock();
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-09  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-08 13:02 [patch] staging: lowmemorykiller: remove bogus NULL check Dan Carpenter
2016-04-09  0:52 ` Tetsuo Handa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.