From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 2/5] tracepoint: Convert process iteration to use for_each_process_thread()
Date: Wed, 9 Apr 2014 16:28:35 +0000 (UTC) [thread overview]
Message-ID: <360091921.1294.1397060915052.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <1397059882-23063-3-git-send-email-fweisbec@gmail.com>
----- Original Message -----
> From: "Frederic Weisbecker" <fweisbec@gmail.com>
> To: "LKML" <linux-kernel@vger.kernel.org>
> Cc: "Frederic Weisbecker" <fweisbec@gmail.com>, "Andrew Morton" <akpm@linux-foundation.org>, "Ingo Molnar"
> <mingo@kernel.org>, "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>, "Oleg Nesterov" <oleg@redhat.com>, "Steven
> Rostedt" <rostedt@goodmis.org>
> Sent: Wednesday, April 9, 2014 12:11:19 PM
> Subject: [PATCH 2/5] tracepoint: Convert process iteration to use for_each_process_thread()
>
> do_each_thread/while_each_thread iterators are deprecated by
> for_each_thread/for_each_process_thread() APIs.
>
> Lets convert the callers in the tracepoint code. The ultimate
> goal is to remove the struct task_struct::thread_group field and
> the corresponding do_each_thread/while_each_thread iterators that are
> RCU unsafe.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> ---
> kernel/tracepoint.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
> index fb0a38a..00a7e8b 100644
> --- a/kernel/tracepoint.c
> +++ b/kernel/tracepoint.c
> @@ -561,15 +561,15 @@ static int sys_tracepoint_refcount;
> void syscall_regfunc(void)
> {
> unsigned long flags;
> - struct task_struct *g, *t;
> + struct task_struct *p, *t;
>
> if (!sys_tracepoint_refcount) {
> read_lock_irqsave(&tasklist_lock, flags);
> - do_each_thread(g, t) {
> + for_each_process_thread(p, t) {
What are the locking rules for for_each_process_thread() ?
Is it required to hold RCU read-side lock ? (it's not the case here)
Is tasklist_lock read-side lock sufficient ?
A quick glance at those for_each iterator defines in sched.h was not
helpful in finding this information.
Thanks,
Mathieu
> /* Skip kernel threads. */
> if (t->mm)
> set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
> - } while_each_thread(g, t);
> + }
> read_unlock_irqrestore(&tasklist_lock, flags);
> }
> sys_tracepoint_refcount++;
> @@ -578,14 +578,14 @@ void syscall_regfunc(void)
> void syscall_unregfunc(void)
> {
> unsigned long flags;
> - struct task_struct *g, *t;
> + struct task_struct *p, *t;
>
> sys_tracepoint_refcount--;
> if (!sys_tracepoint_refcount) {
> read_lock_irqsave(&tasklist_lock, flags);
> - do_each_thread(g, t) {
> + for_each_process_thread(p, t) {
> clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
> - } while_each_thread(g, t);
> + }
> read_unlock_irqrestore(&tasklist_lock, flags);
> }
> }
> --
> 1.8.3.1
>
>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2014-04-09 16:28 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 16:11 [PATCH 0/5] core: Convert thread iteration to use for_each[_process]_thread APIs, 1st pile Frederic Weisbecker
2014-04-09 16:11 ` [PATCH 1/5] sched: Convert thread_group_cputime() to use for_each_thread() Frederic Weisbecker
2014-04-09 17:12 ` Oleg Nesterov
2014-04-09 17:16 ` Peter Zijlstra
2014-04-09 17:32 ` Oleg Nesterov
2014-04-09 18:30 ` Peter Zijlstra
2014-04-09 19:46 ` Oleg Nesterov
2014-04-09 19:49 ` Peter Zijlstra
2014-04-10 16:19 ` Peter Zijlstra
2014-04-10 16:32 ` Peter Zijlstra
2014-04-10 17:29 ` Oleg Nesterov
2014-04-10 17:36 ` Peter Zijlstra
2014-04-10 17:42 ` Peter Zijlstra
2014-04-10 19:15 ` Oleg Nesterov
2014-04-10 20:55 ` Peter Zijlstra
2014-04-10 7:56 ` Ingo Molnar
2014-04-09 16:11 ` [PATCH 2/5] tracepoint: Convert process iteration to use for_each_process_thread() Frederic Weisbecker
2014-04-09 16:28 ` Mathieu Desnoyers [this message]
2014-04-09 16:40 ` Frederic Weisbecker
2014-04-09 16:42 ` Steven Rostedt
2014-04-09 17:05 ` [PATCH 0/2] Was: " Oleg Nesterov
2014-04-09 17:05 ` [PATCH RESEND 1/2] tracing: syscall_*regfunc() can race with copy_process() Oleg Nesterov
2014-04-10 13:04 ` Steven Rostedt
2014-04-10 13:33 ` Oleg Nesterov
2014-04-10 13:06 ` Steven Rostedt
2014-04-10 13:34 ` Oleg Nesterov
2014-04-11 15:22 ` Steven Rostedt
2014-04-11 15:58 ` Oleg Nesterov
2014-04-13 18:58 ` [PATCH v2 0/3] tracing: syscall_*regfunc() fixes Oleg Nesterov
2014-04-13 18:58 ` [PATCH v2 1/3] tracing: fix syscall_*regfunc() vs copy_process() race Oleg Nesterov
2014-04-14 23:57 ` Frederic Weisbecker
2014-04-13 18:59 ` [PATCH v2 2/3] tracing: change syscall_*regfunc() to check PF_KTHREAD and use for_each_process_thread() Oleg Nesterov
2014-04-13 18:59 ` [PATCH v2 3/3] tracing: syscall_regfunc() should not skip kernel threads Oleg Nesterov
2014-04-14 23:46 ` [PATCH v2 0/3] tracing: syscall_*regfunc() fixes Frederic Weisbecker
2014-06-18 14:23 ` Steven Rostedt
2014-06-18 15:36 ` Oleg Nesterov
2014-04-09 17:06 ` [PATCH RESEND 2/2] tracing: syscall_regfunc() should not skip kernel threads Oleg Nesterov
2014-04-10 13:28 ` Steven Rostedt
2014-04-10 13:38 ` Oleg Nesterov
2014-04-10 14:28 ` Steven Rostedt
2014-04-10 14:46 ` Oleg Nesterov
2014-04-10 15:08 ` Steven Rostedt
2014-04-10 17:57 ` Oleg Nesterov
2014-04-10 18:14 ` Oleg Nesterov
2014-04-10 19:00 ` Oleg Nesterov
2014-04-10 19:13 ` Steven Rostedt
2014-04-10 19:38 ` Oleg Nesterov
2014-04-10 19:55 ` Steven Rostedt
2014-04-11 12:03 ` Oleg Nesterov
2014-04-11 12:37 ` Steven Rostedt
2014-04-10 13:03 ` [PATCH 0/2] Was: Convert process iteration to use for_each_process_thread() Steven Rostedt
2014-04-09 16:11 ` [PATCH 3/5] hung_task: " Frederic Weisbecker
2014-04-09 17:23 ` Oleg Nesterov
2014-04-09 16:11 ` [PATCH 4/5] procfs: Convert process iteration to use for_each_thread() Frederic Weisbecker
2014-04-09 16:11 ` [PATCH 5/5] sched: Convert tasks iteration to use for_each_process_thread() Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=360091921.1294.1397060915052.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox