lkml.org 
[lkml]   [2006]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] pids: simplify do_each_task_pid/while_each_task_pid
    Simpllify do_each_task_pid/while_each_task_pid macros.
    This also makes the code a bit smaller.

    Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

    --- MM/include/linux/pid.h~ 2006-03-23 22:48:10.000000000 +0300
    +++ MM/include/linux/pid.h 2006-04-13 20:28:53.000000000 +0400
    @@ -99,21 +99,16 @@ extern void FASTCALL(free_pid(struct pid
    pids[(type)].node)


    -/* We could use hlist_for_each_entry_rcu here but it takes more arguments
    - * than the do_each_task_pid/while_each_task_pid. So we roll our own
    - * to preserve the existing interface.
    - */
    -#define do_each_task_pid(who, type, task) \
    - if ((task = find_task_by_pid_type(type, who))) { \
    - prefetch(pid_next(task, type)); \
    - do {
    -
    -#define while_each_task_pid(who, type, task) \
    - } while (pid_next(task, type) && ({ \
    - task = pid_next_task(task, type); \
    - rcu_dereference(task); \
    - prefetch(pid_next(task, type)); \
    - 1; }) ); \
    - }
    +#define do_each_task_pid(who, type, task) \
    + do { \
    + struct hlist_node *pos___; \
    + struct pid *pid___ = find_pid(who); \
    + if (pid___ != NULL) \
    + hlist_for_each_entry_rcu((task), pos___, \
    + &pid___->tasks[type], pids[type].node) {
    +
    +#define while_each_task_pid(who, type, task) \
    + } \
    + } while (0)

    #endif /* _LINUX_PID_H */
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-04-13 14:43    [W:4.001 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site