one small doubt, shouldn't we be acquiring a lock while iterating over all the tasks ?
anupam
> for_each_task(p) > { > ... > } > > You will each task's descriptor on p on each loop. The first one will be > that of init. You will automatically break from loop when you finish > traverse through all tasks. > Actually a circular list. > > #define for_each_task(p) \ > for (p = &init_task ; (p = p->next_task) != &init_task ; ) > > regards manish >
No, Lock is unnecessary here, we are not manipulating the list, just following the link. Lock is necessary if you add or remove from the list.
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/