Re: [RFC] O(1) proc_pid_readdir

Manfred Spraul (manfred@colorfullife.com)
Sun, 16 Mar 2003 22:24:34 +0100


Ingo Molnar wrote:

>On Sun, 16 Mar 2003, Manfred Spraul wrote:
>
>
>
>>Below is a proposal to get rid of the quadratic behaviour of
>>proc_pid_readir(): Instead of storing the task number in f_pos and
>>walking tasks by tasklist order, the pid is stored in f_pos and the
>>tasks are walked by (hash-mangled) pid order.
>>
>>
>
>have you seen my "procfs/procps threading performance speedup" patch? It
>does something like this.
>
Interesting patch. Do seekdir and telldir still work? I think you must
detect lseek calls and invalidate the cookie - either by hooking lseek
or by looking at f_version.

I think my solution for proc_pid_readdir() is better: You must fall back
to the old algorithm if the pid number stored in f_private got invalid
between two syscalls. I've modified the hash table slightly and search
for the next pid value directly, which works even if the current
position disappeared.

--
    Manfred

- 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/