lkml.org 
[lkml]   [2009]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/4] trace_workqueue: use list_for_each_entry() instead of list_for_each_entry_safe()
    On Mon, Apr 20, 2009 at 02:58:26PM +0800, Zhaolei wrote:
    > No need to use list_for_each_entry_safe() in iteration without delete node,
    > we use list_for_each_entry() instead.
    >
    > Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
    > ---
    > kernel/trace/trace_workqueue.c | 10 ++++------
    > 1 files changed, 4 insertions(+), 6 deletions(-)
    >
    > diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
    > index 984b917..934b27c 100644
    > --- a/kernel/trace/trace_workqueue.c
    > +++ b/kernel/trace/trace_workqueue.c
    > @@ -47,12 +47,11 @@ probe_workqueue_insertion(struct task_struct *wq_thread,
    > struct work_struct *work)
    > {
    > int cpu = cpumask_first(&wq_thread->cpus_allowed);
    > - struct cpu_workqueue_stats *node, *next;
    > + struct cpu_workqueue_stats *node;
    > unsigned long flags;
    >
    > spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags);
    > - list_for_each_entry_safe(node, next, &workqueue_cpu_stat(cpu)->list,
    > - list) {
    > + list_for_each_entry(node, &workqueue_cpu_stat(cpu)->list, list) {
    > if (node->pid == wq_thread->pid) {
    > atomic_inc(&node->inserted);
    > goto found;
    > @@ -69,12 +68,11 @@ probe_workqueue_execution(struct task_struct *wq_thread,
    > struct work_struct *work)
    > {
    > int cpu = cpumask_first(&wq_thread->cpus_allowed);
    > - struct cpu_workqueue_stats *node, *next;
    > + struct cpu_workqueue_stats *node;
    > unsigned long flags;
    >
    > spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags);
    > - list_for_each_entry_safe(node, next, &workqueue_cpu_stat(cpu)->list,
    > - list) {
    > + list_for_each_entry(node, &workqueue_cpu_stat(cpu)->list, list) {
    > if (node->pid == wq_thread->pid) {
    > node->executed++;
    > goto found;


    Thanks, looks good.

    Acked-by: Frederic Weisbecker <fweisbec@gmail.com>



    \
     
     \ /
      Last update: 2009-04-20 09:29    [W:0.026 / U:64.468 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site