public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* broken do_each_pid_{thread,task}
@ 2008-12-14 21:59 Jiri Slaby
  2008-12-15  1:02 ` Eric W. Biederman
  2008-12-15 10:24 ` broken do_each_pid_{thread,task} Oleg Nesterov
  0 siblings, 2 replies; 14+ messages in thread
From: Jiri Slaby @ 2008-12-14 21:59 UTC (permalink / raw)
  To: oleg; +Cc: kenchen, Linux kernel mailing list, Eric W. Biederman

Hi,

I'm getting
`if (type == PIDTYPE_PID)' is unreachable
warning from kernel/exit.c. The preprocessed code looks like:
do {
         struct hlist_node *pos___;
         if (pgrp != ((void *)0))
                 for (LIST ITERATION) {
                         {
                          if (!((p->state & 4) != 0))
                           continue;
                          retval = 1;
                          break;
                         }
                         if (PIDTYPE_PGID == PIDTYPE_PID)
                                 break;
                 }
} while (0);
and it's obviously wrong.

After investigating this code usage all around, it's broken on many places
this or similar way.

For do_each_pid_thread(), even this code snippet from fs/ioprio.c is broken
due to double do {} while expansion:
do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
  ret = set_task_ioprio(p, ioprio);
  if (ret)
    break;
} while_each_pid_thread(pgrp, PIDTYPE_PGID, p);

Any idea how to get rid of this issue?

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-10-12 10:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-14 21:59 broken do_each_pid_{thread,task} Jiri Slaby
2008-12-15  1:02 ` Eric W. Biederman
2008-12-15 10:47   ` Oleg Nesterov
2008-12-15 17:09     ` Oleg Nesterov
2009-02-24 13:22       ` Jiri Slaby
2009-02-24 15:49         ` Oleg Nesterov
2009-02-24 16:21           ` Jiri Slaby
2009-02-24 21:49             ` [RFC, PATCH] introduce pid_for_each_task() to replace do_each_pid_task() Oleg Nesterov
2008-12-15 10:24 ` broken do_each_pid_{thread,task} Oleg Nesterov
2008-12-15 10:50   ` Jiri Slaby
2008-12-15 11:02     ` Oleg Nesterov
2008-12-15 11:33       ` Jiri Slaby
2008-12-15 11:51         ` Oleg Nesterov
2009-10-12 10:55           ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox