lkml.org 
[lkml]   [2002]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: ps performance sucks (was Re: dcache_rcu [performance results])
    Martin J. Bligh wrote:
    > I had a very brief think about this at the weekend, seeing
    > if I could make a big melting pot /proc/psinfo file

    You could take a more radical approach. Since the goal of such
    a psinfo file would be to accelerate access to information
    that's already available elsewhere, you can do away with many
    of the niceties of procfs, e.g.

    - no need to be human-readable (e.g. binary or hex dump may
    make sense in this case)
    - may use other operations than just open and read (e.g.
    do an initial write to select what should be read)
    - you may cache previous responses and only output deltas
    (not sure if this is useful - all you'd safe is the
    actual copy to user space)

    Actually, I think attempting to just make it brutally efficient,
    no matter how much nastiness you amass doing that, might be
    good approach for a first version. Then, if people are
    digusted, you can make things nicer, and keep track of how
    much performance you're losing.

    Example:

    First write says "pid,comm". Internally, this gets translated
    to 0x8c+0x04, 0x2ee+0x10 (offset+length). Next read returns
    "pid 4,comm 16" (include the name, so you can indicate fields
    the kernel doesn't recognize). Then, kmalloc 20*tasks bytes,
    lock, copy the fields from struct task_struct, unlock, let the
    stuff be read by user space, kfree. Adjacent fields can be
    optimized to single byte strings at setup time.

    - Werner

    --
    _________________________________________________________________________
    / Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net /
    /_http://www.almesberger.net/____________________________________________/
    -
    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: 2005-03-22 13:30    [W:0.021 / U:95.676 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site