more next_thread/while_each_thread changes
cover more next_thread/while_each_thread changes
Trivial, change the remaining next_thread (ab)users to use while_each_thread().
The last user which should be changed is next_tid(), but we can't do this now.
__exit_signal() and complete_signal() are fine, they actually need next_thread() logic.
Oleg.
fs/proc/array.c | 3 +-- kernel/signal.c | 7 +++---- kernel/sys.c | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-)
PATCH 1/3 proc: change do_task_stat() to use while_each_thread()
do_task_stat() can use while_each_thread(), no changes in the compiled code.
--- fs/proc/array.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
fs/proc/array.c +1 -2
@@ -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;
Signature · 1 line
1.5.5.1
PATCH 2/3 k_getrusage() can use while_each_thread()
In reply to Oleg NesterovChange k_getrusage() to use while_each_thread(), no changes in the compiled code.
--- kernel/sys.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/sys.c +1 -2
@@ -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:
Signature · 1 line
1.5.5.1
PATCH 3/3 signals: change do_signal_stop/do_sigaction to use while_each_thread()
In reply to Oleg NesterovChange do_signal_stop() and do_sigaction() to avoid next_thread() and use while_each_thread() instead.
--- kernel/signal.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
kernel/signal.c +3 -4
@@ -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); } }
Signature · 1 line
1.5.5.1
Re: [PATCH 1/3] proc: change do_task_stat() to use while_each_thread()
In reply to Oleg NesterovQuoted 4 lines · Oleg Nesterov
do_task_stat()can usewhile_each_thread(), no changes in the compiled code.Signed-off-by Oleg Nesterov <[email protected]>
Quoted 21 lines
--- fs/proc/array.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)fs/proc/array.c +1
-3@@ -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
Re: [PATCH 2/3] k_getrusage() can use while_each_thread()
In reply to Oleg NesterovQuoted 4 lines · Oleg Nesterov
Change
k_getrusage()to usewhile_each_thread(), no changes in the compiled code.Signed-off-by Oleg Nesterov <[email protected]>
Quoted 21 lines
--- kernel/sys.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)kernel/sys.c +1
-3@@ -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
Re: [PATCH 3/3] signals: change do_signal_stop/do_sigaction to use while_each_thread()
In reply to Oleg NesterovQuoted 4 lines · Oleg Nesterov
Change
do_signal_stop()anddo_sigaction()to avoidnext_thread()and usewhile_each_thread()instead.Signed-off-by Oleg Nesterov <[email protected]>
Quoted 32 lines
--- kernel/signal.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)kernel/signal.c +3
-5@@ -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
Signature · 1 line
Sameer