All of lore.kernel.org
 help / color / mirror / Atom feed
* /proc reliability & performance
@ 2003-10-17  2:07 Albert Cahalan
  2003-10-17  2:34 ` Larry McVoy
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Albert Cahalan @ 2003-10-17  2:07 UTC (permalink / raw)
  To: linux-kernel mailing list

I created a process with 360 thousand threads,
went into the /proc/*/task directory, and did
a simple /bin/ls. It took over 9 minutes on a
nice fast Opteron. (it's the same at top-level
with processes, but I wasn't about to mess up
my system that much)

OK, that's a bit extreme, but it does show a
scalability problem. There is an O(n*n)
algorithm in there. Here is a proposed fix:

Tie directory readers to a task_struct (or to
some of the PID tracking structs), so that
a directory reader is on a list. When a task
exits, move the list of directory readers on
to a neighboring task.

That is O(1) on task exit, and generally O(n)
for the whole /proc or /proc/42/task read.
It's O(1) per step of the read, excepting
where multiple directory readers wind up at
the same location.

Another benefit is that it is reliable as
long as tasks don't move around on the lists.
Each task will appear at most once, and will
appear exactly once if it doesn't start or
exit during the directory scan.



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-10-18  6:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-17  2:07 /proc reliability & performance Albert Cahalan
2003-10-17  2:34 ` Larry McVoy
2003-10-17  8:01   ` dada1
2003-10-17  9:10     ` David S. Miller
2003-10-17 14:46       ` Valdis.Kletnieks
2003-10-17 17:24       ` dada1
2003-10-17 23:48       ` Albert Cahalan
2003-10-18  6:35       ` Willy Tarreau
2003-10-18  6:38         ` David S. Miller
2003-10-17  2:51 ` William Lee Irwin III
2003-10-17  3:24 ` Brian McGroarty
2003-10-17  4:31   ` Albert Cahalan
2003-10-17  4:56     ` William Lee Irwin III
2003-10-17  8:21     ` David Rees
2003-10-17  7:40 ` Zan Lynx
2003-10-17  7:54   ` William Lee Irwin III

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.