----- Original Message -----
> From: "Frederic Weisbecker" <fweis...@gmail.com>
> To: "LKML" <linux-kernel@vger.kernel.org>
> Cc: "Frederic Weisbecker" <fweis...@gmail.com>, "Andrew Morton" 
> <a...@linux-foundation.org>, "Ingo Molnar"
> <mi...@kernel.org>, "Mathieu Desnoyers" <mathieu.desnoy...@efficios.com>, 
> "Oleg Nesterov" <o...@redhat.com>, "Steven
> Rostedt" <rost...@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 <a...@linux-foundation.org>
> Cc: Ingo Molnar <mi...@kernel.org>
> Cc: Mathieu Desnoyers <mathieu.desnoy...@efficios.com>
> Cc: Oleg Nesterov <o...@redhat.com>
> Cc: Steven Rostedt <rost...@goodmis.org>
> Signed-off-by: Frederic Weisbecker <fweis...@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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to