[lkml]   [2012]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] speed up /proc/pid/stat, statm
    Le mercredi 01 février 2012 à 08:55 +0900, KAMEZAWA Hiroyuki a écrit :

    > seq_xxxx functions set m->count == m->size when it finds possible buffer overflow.
    > If m->count == m->size after ->show(), buffer will be freed and twice size buffer
    > will be re-allocated, and retry.
    > If we don't set m->count == m->size here, following seq_putc() will succeed and
    > we'll see corrupted outputs.

    I suppose we could define a self documented helper

    void seq_overflow(struct seq_file *seq)
    seq->count = seq->size;

    Or if we were counting the approximate number of missing bytes, we could
    avoid some iterations of the "double size buffer".

    (letting seq->count going above seq->size, but not allowing buffer
    overflow of course !)

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2012-02-01 06:57    [W:0.020 / U:3.452 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site