lkml.org 
[lkml]   [1998]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: /proc/PID/stat breakage [PATCH]
Date
In article <19980301115250.16112@calvin.polyware.nl>,
Jeanette Pauline Middelink <middelin@polyware.nl> wrote:
>
>Your patch implies that the state field can only contain a single
>bit, but the TASK_ bit ordering suggests the possibility for
>multiple bit settings.

This is unlikely to ever happen. The reason for the bitmask is not
because I wanted to set multiple states at once - it's because I wanted
to _test_ for multiple states in one go. So instead of having code like

if (task->state == TASK_INTERRUPTIBLE || task->state == TASK_UNINTERRUPTIBLE)
...

the bitmap allows a

if (task_state & (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE))
...

Actually, they shouldn't even be considered "state bits" as much as
"reasons for sleeping bits": TASK_RUNNING is zero, indicating that is
has no reason to sleep.

I _may_ at some time consider allowing a process to have multiple sleep
reasons (for example, it may be blocked for paging during trying to go
to a normal interruptible sleep), but as I said this is fairly unlikely.

> (Uninterruptable running zombie?)
>The switch you patched does not handle such cases.
>However, after checking some uses of the task state it seems
>most checking is done by == or !=...

Most checking is still done by "==" or "!=", but that's because it had
to be done that way with the old scheme. The new numbering allows us to
do either bitwise tests _or_ equality test.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.027 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site