lkml.org 
[lkml]   [2006]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC] ps command race fix
    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 <pj@sgi.com> 1.925.600.0401
    -
    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-07-25 09:25    [W:0.021 / U:89.456 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site