aboutsummaryrefslogtreecommitdiff
path: root/arch/sh64/lib/page_copy.S
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-03-28 01:56:33 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 09:16:04 -0800
commit70674f95c0a2ea694d5c39f4e514f538a09be36f (patch)
tree906d109fafc5eafff6a90c8d866e0525fdaf6783 /arch/sh64/lib/page_copy.S
parentb02389e98a7b64ad5cd4823740defa8821f30bbd (diff)
[PATCH] Optimize select/poll by putting small data sets on the stack
Optimize select and poll by a using stack space for small fd sets This brings back an old optimization from Linux 2.0. Using the stack is faster than kmalloc. On a Intel P4 system it speeds up a select of a single pty fd by about 13% (~4000 cycles -> ~3500) It also saves memory because a daemon hanging in select or poll will usually save one or two less pages. This can add up - e.g. if you have 10 daemons blocking in poll/select you save 40KB of memory. I did a patch for this long ago, but it was never applied. This version is a reimplementation of the old patch that tries to be less intrusive. I only did the minimal changes needed for the stack allocation. The cut off point before external memory is allocated is currently at 832bytes. The system calls always allocate this much memory on the stack. These 832 bytes are divided into 256 bytes frontend data (for the select bitmaps of the pollfds) and the rest of the space for the wait queues used by the low level drivers. There are some extreme cases where this won't work out for select and it falls back to allocating memory too early - especially with very sparse large select bitmaps - but the majority of processes who only have a small number of file descriptors should be ok. [TBD: 832/256 might not be the best split for select or poll] I suspect more optimizations might be possible, but they would be more complicated. One way would be to cache the select/poll context over multiple system calls because typically the input values should be similar. Problem is when to flush the file descriptors out though. Signed-off-by: Andi Kleen <ak@suse.de> Cc: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/sh64/lib/page_copy.S')
0 files changed, 0 insertions, 0 deletions