linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc_oom_score: remove tasklist_lock and pid_alive()
@ 2016-06-08 21:19 Oleg Nesterov
  2016-06-08 22:48 ` David Rientjes
  2016-06-09  6:44 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: Oleg Nesterov @ 2016-06-08 21:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Rientjes, Michal Hocko, Tetsuo Handa, linux-kernel

This was needed before to ensure that ->signal != 0 and do_each_thread()
is safe, see the commit b95c35e76b29b for details.

Today tsk->signal can't go away and for_each_thread(tsk) is always safe.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 fs/proc/base.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index a11eb71..93e7754 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -579,11 +579,8 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
 	unsigned long totalpages = totalram_pages + total_swap_pages;
 	unsigned long points = 0;
 
-	read_lock(&tasklist_lock);
-	if (pid_alive(task))
-		points = oom_badness(task, NULL, NULL, totalpages) *
-						1000 / totalpages;
-	read_unlock(&tasklist_lock);
+	points = oom_badness(task, NULL, NULL, totalpages) *
+					1000 / totalpages;
 	seq_printf(m, "%lu\n", points);
 
 	return 0;
-- 
2.5.0

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

* Re: [PATCH] proc_oom_score: remove tasklist_lock and pid_alive()
  2016-06-08 21:19 [PATCH] proc_oom_score: remove tasklist_lock and pid_alive() Oleg Nesterov
@ 2016-06-08 22:48 ` David Rientjes
  2016-06-09  6:44 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2016-06-08 22:48 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, Michal Hocko, Tetsuo Handa, linux-kernel

On Wed, 8 Jun 2016, Oleg Nesterov wrote:

> This was needed before to ensure that ->signal != 0 and do_each_thread()
> is safe, see the commit b95c35e76b29b for details.
> 
> Today tsk->signal can't go away and for_each_thread(tsk) is always safe.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH] proc_oom_score: remove tasklist_lock and pid_alive()
  2016-06-08 21:19 [PATCH] proc_oom_score: remove tasklist_lock and pid_alive() Oleg Nesterov
  2016-06-08 22:48 ` David Rientjes
@ 2016-06-09  6:44 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2016-06-09  6:44 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, David Rientjes, Tetsuo Handa, linux-kernel

On Wed 08-06-16 23:19:21, Oleg Nesterov wrote:
> This was needed before to ensure that ->signal != 0 and do_each_thread()
> is safe, see the commit b95c35e76b29b for details.
> 
> Today tsk->signal can't go away and for_each_thread(tsk) is always safe.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  fs/proc/base.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index a11eb71..93e7754 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -579,11 +579,8 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
>  	unsigned long totalpages = totalram_pages + total_swap_pages;
>  	unsigned long points = 0;
>  
> -	read_lock(&tasklist_lock);
> -	if (pid_alive(task))
> -		points = oom_badness(task, NULL, NULL, totalpages) *
> -						1000 / totalpages;
> -	read_unlock(&tasklist_lock);
> +	points = oom_badness(task, NULL, NULL, totalpages) *
> +					1000 / totalpages;
>  	seq_printf(m, "%lu\n", points);
>  
>  	return 0;
> -- 
> 2.5.0
> 

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2016-06-09  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08 21:19 [PATCH] proc_oom_score: remove tasklist_lock and pid_alive() Oleg Nesterov
2016-06-08 22:48 ` David Rientjes
2016-06-09  6:44 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).