Re: [RFC] ps command race fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew wrote:
> We cannot do a single kmalloc() like cpuset does.

Ok ...

Well, since you're so impressed with the studliness of that idea
<grin>, how about this:

  Add a 'false link' to the .next task list.

Each diropen on /proc and each open on a cpuset 'tasks' file would
add one such 'false link' to the task list, representing that file
descriptors current seek offset in the task list.

A 'false link' would be a task_struct that was almost entirely unused,
except to mark the offset in the task list of a file descriptor open
on it (for /proc or cpuset 'tasks' files.)

The 'normal' do_each_thread/while_each_thread and related macros would
silently skip over these false links.

The /proc and cpuset 'tasks' code would use special macros that could
see the false link representing its current seek offset, and be able
to implement read and seek operations relative to that position.

Remove this 'false link' on the final close of the file descriptor
holding it.

This reduces the memory cost of an open on /proc or a 'tasks' file to
the size of a single 'false link' task_struct.

It -would- add another test and jump to the critical do_each_thread and
while_each_thread macros, to skip over 'false links'.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
-
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]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux