Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1417873 > unrolled thread

[PATCH] proc_oom_score: remove tasklist_lock and pid_alive()

Started byOleg Nesterov <oleg@redhat.com>
First post2016-06-08 23:20 +0200
Last post2016-06-09 08:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] proc_oom_score: remove tasklist_lock and pid_alive() Oleg Nesterov <oleg@redhat.com> - 2016-06-08 23:20 +0200
    Re: [PATCH] proc_oom_score: remove tasklist_lock and pid_alive() David Rientjes <rientjes@google.com> - 2016-06-09 00:50 +0200
    Re: [PATCH] proc_oom_score: remove tasklist_lock and pid_alive() Michal Hocko <mhocko@kernel.org> - 2016-06-09 08:50 +0200

#1417873 — [PATCH] proc_oom_score: remove tasklist_lock and pid_alive()

FromOleg Nesterov <oleg@redhat.com>
Date2016-06-08 23:20 +0200
Subject[PATCH] proc_oom_score: remove tasklist_lock and pid_alive()
Message-ID<rHT3k-5qw-7@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1417934

FromDavid Rientjes <rientjes@google.com>
Date2016-06-09 00:50 +0200
Message-ID<rHUsp-6dO-9@gated-at.bofh.it>
In reply to#1417873
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>

[toc] | [prev] | [next] | [standalone]


#1418108

FromMichal Hocko <mhocko@kernel.org>
Date2016-06-09 08:50 +0200
Message-ID<rI1WW-2L4-21@gated-at.bofh.it>
In reply to#1417873
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web