[PATCH] fix f_version optimization for get_tgid_list
The kernel contains an optimization that skips the linked list walk in get_tgid_list for the common case of sequential accesses. Unfortunately the optimization is buggy (missing NULL pointer check for the result of find_task_by_pid) and broken (actually - broken twice: the tgid value that is stored in f_version is always 0 because tgid is overwritten when the string is created and additionally the common case is not filldir < 0, it's running out of nr_tgids). The attached patch fixes these bugs. Roger Luethi <rl@hellgate.ch> ran a benchmark: test: top -d 0 -b -n 10 > /dev/null ==> 2.6.8 <== real 0m19.092s user 0m5.013s sys 0m12.622s ==> 2.6.8 + patch-tgid-bugfixes <== real 0m10.062s user 0m5.042s sys 0m4.111s Signed-Off-By: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing
Please register or sign in to comment