]> git.baikalelectronics.ru Git - kernel.git/commit
audit: acquire creds selectively to reduce atomic op overhead
authorTony Jones <tonyj@suse.de>
Wed, 27 Apr 2011 13:10:49 +0000 (15:10 +0200)
committerJiri Kosina <jkosina@suse.cz>
Wed, 27 Apr 2011 13:11:03 +0000 (15:11 +0200)
commite9c3f8c22d556934343795be0b9073651c8b17cf
tree37acb6cfdb47681f38e0aa68d20ffd2934710666
parentf45cc0132d91d28b022018c4c3796b1f595e8fc8
audit: acquire creds selectively to reduce atomic op overhead

Commit fb986a5a0617 ("CRED: Use RCU to access another task's creds and to
release a task's own creds") added calls to get_task_cred and put_cred in
audit_filter_rules.  Profiling with a large number of audit rules active
on the exit chain shows that we are spending upto 48% in this routine for
syscall intensive tests, most of which is in the atomic ops.

1. The code should be accessing tsk->cred rather than tsk->real_cred.
2. Since tsk is current (or tsk is being created by copy_process) access to
tsk->cred without rcu read lock is possible.  At the request of the audit
maintainer, a new flag has been added to audit_filter_rules in order to make
this explicit and guide future code.

Signed-off-by: Tony Jones <tonyj@suse.de>
Acked-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
kernel/auditsc.c