* [PATCH 1/3] proc: change do_task_stat() to use while_each_thread()
2013-11-22 19:18 [PATCH 0/3] more next_thread/while_each_thread changes Oleg Nesterov
@ 2013-11-22 19:18 ` Oleg Nesterov
2013-11-22 20:15 ` Sameer Nanda
2013-11-22 19:18 ` [PATCH 2/3] k_getrusage() can " Oleg Nesterov
2013-11-22 19:18 ` [PATCH 3/3] signals: change do_signal_stop/do_sigaction to " Oleg Nesterov
2 siblings, 1 reply; 7+ messages in thread
From: Oleg Nesterov @ 2013-11-22 19:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Michal Hocko, Sameer Nanda, Sergey Dyasly, linux-kernel
do_task_stat() can use while_each_thread(), no changes in
the compiled code.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
fs/proc/array.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index c995807..c59e74f 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -442,8 +442,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
min_flt += t->min_flt;
maj_flt += t->maj_flt;
gtime += task_gtime(t);
- t = next_thread(t);
- } while (t != task);
+ } while_each_thread(task, t);
min_flt += sig->min_flt;
maj_flt += sig->maj_flt;
--
1.5.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] proc: change do_task_stat() to use while_each_thread()
2013-11-22 19:18 ` [PATCH 1/3] proc: change do_task_stat() to use while_each_thread() Oleg Nesterov
@ 2013-11-22 20:15 ` Sameer Nanda
0 siblings, 0 replies; 7+ messages in thread
From: Sameer Nanda @ 2013-11-22 20:15 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: Andrew Morton, Michal Hocko, Sergey Dyasly, linux-kernel
On Fri, Nov 22, 2013 at 11:18 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> do_task_stat() can use while_each_thread(), no changes in
> the compiled code.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
> ---
> fs/proc/array.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/array.c b/fs/proc/array.c
> index c995807..c59e74f 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -442,8 +442,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
> min_flt += t->min_flt;
> maj_flt += t->maj_flt;
> gtime += task_gtime(t);
> - t = next_thread(t);
> - } while (t != task);
> + } while_each_thread(task, t);
>
> min_flt += sig->min_flt;
> maj_flt += sig->maj_flt;
> --
> 1.5.5.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] k_getrusage() can use while_each_thread()
2013-11-22 19:18 [PATCH 0/3] more next_thread/while_each_thread changes Oleg Nesterov
2013-11-22 19:18 ` [PATCH 1/3] proc: change do_task_stat() to use while_each_thread() Oleg Nesterov
@ 2013-11-22 19:18 ` Oleg Nesterov
2013-11-22 20:16 ` Sameer Nanda
2013-11-22 19:18 ` [PATCH 3/3] signals: change do_signal_stop/do_sigaction to " Oleg Nesterov
2 siblings, 1 reply; 7+ messages in thread
From: Oleg Nesterov @ 2013-11-22 19:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Michal Hocko, Sameer Nanda, Sergey Dyasly, linux-kernel
Change k_getrusage() to use while_each_thread(), no changes in
the compiled code.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/sys.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 1d9a218..70d56d6 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1572,8 +1572,7 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r)
t = p;
do {
accumulate_thread_rusage(t, r);
- t = next_thread(t);
- } while (t != p);
+ } while_each_thread(p, t);
break;
default:
--
1.5.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 2/3] k_getrusage() can use while_each_thread()
2013-11-22 19:18 ` [PATCH 2/3] k_getrusage() can " Oleg Nesterov
@ 2013-11-22 20:16 ` Sameer Nanda
0 siblings, 0 replies; 7+ messages in thread
From: Sameer Nanda @ 2013-11-22 20:16 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: Andrew Morton, Michal Hocko, Sergey Dyasly, linux-kernel
On Fri, Nov 22, 2013 at 11:18 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> Change k_getrusage() to use while_each_thread(), no changes in
> the compiled code.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
> ---
> kernel/sys.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sys.c b/kernel/sys.c
> index 1d9a218..70d56d6 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -1572,8 +1572,7 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r)
> t = p;
> do {
> accumulate_thread_rusage(t, r);
> - t = next_thread(t);
> - } while (t != p);
> + } while_each_thread(p, t);
> break;
>
> default:
> --
> 1.5.5.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] signals: change do_signal_stop/do_sigaction to use while_each_thread()
2013-11-22 19:18 [PATCH 0/3] more next_thread/while_each_thread changes Oleg Nesterov
2013-11-22 19:18 ` [PATCH 1/3] proc: change do_task_stat() to use while_each_thread() Oleg Nesterov
2013-11-22 19:18 ` [PATCH 2/3] k_getrusage() can " Oleg Nesterov
@ 2013-11-22 19:18 ` Oleg Nesterov
2013-11-22 20:17 ` Sameer Nanda
2 siblings, 1 reply; 7+ messages in thread
From: Oleg Nesterov @ 2013-11-22 19:18 UTC (permalink / raw)
To: Andrew Morton; +Cc: Michal Hocko, Sameer Nanda, Sergey Dyasly, linux-kernel
Change do_signal_stop() and do_sigaction() to avoid next_thread()
and use while_each_thread() instead.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index ded28b9..086071d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2047,8 +2047,8 @@ static bool do_signal_stop(int signr)
if (task_set_jobctl_pending(current, signr | gstop))
sig->group_stop_count++;
- for (t = next_thread(current); t != current;
- t = next_thread(t)) {
+ t = current;
+ while_each_thread(current, t) {
/*
* Setting state to TASK_STOPPED for a group
* stop is always done with the siglock held,
@@ -3125,8 +3125,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
rm_from_queue_full(&mask, &t->signal->shared_pending);
do {
rm_from_queue_full(&mask, &t->pending);
- t = next_thread(t);
- } while (t != current);
+ } while_each_thread(current, t);
}
}
--
1.5.5.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] signals: change do_signal_stop/do_sigaction to use while_each_thread()
2013-11-22 19:18 ` [PATCH 3/3] signals: change do_signal_stop/do_sigaction to " Oleg Nesterov
@ 2013-11-22 20:17 ` Sameer Nanda
0 siblings, 0 replies; 7+ messages in thread
From: Sameer Nanda @ 2013-11-22 20:17 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: Andrew Morton, Michal Hocko, Sergey Dyasly, linux-kernel
On Fri, Nov 22, 2013 at 11:18 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> Change do_signal_stop() and do_sigaction() to avoid next_thread()
> and use while_each_thread() instead.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
> ---
> kernel/signal.c | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index ded28b9..086071d 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -2047,8 +2047,8 @@ static bool do_signal_stop(int signr)
> if (task_set_jobctl_pending(current, signr | gstop))
> sig->group_stop_count++;
>
> - for (t = next_thread(current); t != current;
> - t = next_thread(t)) {
> + t = current;
> + while_each_thread(current, t) {
> /*
> * Setting state to TASK_STOPPED for a group
> * stop is always done with the siglock held,
> @@ -3125,8 +3125,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
> rm_from_queue_full(&mask, &t->signal->shared_pending);
> do {
> rm_from_queue_full(&mask, &t->pending);
> - t = next_thread(t);
> - } while (t != current);
> + } while_each_thread(current, t);
> }
> }
>
> --
> 1.5.5.1
>
--
Sameer
^ permalink raw reply [flat|nested] 7+ messages in thread