Linus Torvalds wrote:
On Thu, 29 Sep 2005, Oleg Nesterov wrote:
[...]
However, TASK_NONINTERACTIVE > TASK_STOPPED, so this loop will not
count TASK_INTERRUPTIBLE | TASK_NONINTERACTIVE threads.
[...]
Using ">" for task states is wrong. It's a bitmask, and if you want to
check multiple states, then we should just do so with
if (t->state & (TASK_xxx | TASK_yyy | ...))
Oh, well. The inequality comparisons are shorter, and historical, so I
guess it's debatable whether we should remove them all.
I did a quick grep through 2.6.14-rc2 to see how many "them all" were,
and the only two places I could find, where a inequality operator was
being used on a task state, were this one in kernel/signal.c and another
in kernel/exit.c:
./kernel/exit.c:1194: unlikely(p->state > TASK_STOPPED)
So maybe it is not so bad to just change these to a bit mask and
disallow inequality comparisons in the future, if you guys feel that is
the way to go...
--
Paulo Marques - www.grupopie.com
The rule is perfect: in all matters of opinion our
adversaries are insane.
Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|