Eric Dumazet 231bed2058 [PATCH] No need to protect current->group_info in sys_getgroups(), in_group_p() and in_egroup_p()
While doing some benchmarks of an Apache/PHP SMP server, I noticed high
oprofile numbers in in_group_p() and _atomic_dec_and_lock().

rank  percent
  1     4.8911 % __link_path_walk
  2     4.8503 % __d_lookup
*3     4.2911 % _atomic_dec_and_lock
  4     3.9307 % __copy_to_user_ll
  5     4.9004 % sysenter_past_esp
*6     3.3248 % in_group_p

It appears that in_group_p() does an uncessary

get_group_info(current->group_info); /* atomic_inc() */
  ... /* access current->group_info */
put_group_info(current->group_info); /* _atomic_dec_and_lock */

It is not necessary to do this, because the current task holds a reference
on its own group_info, and this reference cannot change during the lookup.

This patch deletes the get_group_info()/put_group_info() pair from
sys_getgroups(), in_group_p() and in_egroup_p() functions.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Tim Hockin <thockin@hockin.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-25 08:22:58 -08:00
..
2006-03-23 07:38:10 -08:00
2006-01-11 18:42:13 -08:00
2006-01-18 19:20:30 -08:00
2006-02-24 14:05:47 +11:00
2005-04-16 15:20:36 -07:00
2006-03-23 07:38:11 -08:00
2005-04-16 15:20:36 -07:00
2005-10-30 17:37:32 -08:00
2006-01-11 18:42:13 -08:00
2005-10-08 15:00:57 -07:00
2006-03-23 07:38:12 -08:00
2006-03-25 08:22:52 -08:00
2006-01-09 15:59:19 -08:00
2006-01-08 20:13:40 -08:00
2006-03-23 07:38:10 -08:00
2006-03-23 07:38:10 -08:00
2006-03-25 08:22:52 -08:00
2005-04-16 15:20:36 -07:00
2006-01-11 18:42:13 -08:00
2006-03-24 07:33:20 -08:00
2005-04-16 15:20:36 -07:00