umh: Optimize 'proc_cap_handler()'
Subsystems (2)
PATCH 1/1 umh: Optimize 'proc_cap_handler()'
If 'write' is 0, we can avoid a call to spin_lock/spin_unlock.
Signed-off-by Christophe JAILLET <[email protected]>
--- kernel/umh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/umh.c +2 -2
@@ -537,14 +537,14 @@ static int proc_cap_handler(struct ctl_table *table, int write,/* * Drop everything not in the new_cap (but don't add things) */ -spin_lock (&umh_sysctl_lock);if (write) { +spin_lock (&umh_sysctl_lock);if (table->data =CAP_BSET ) usermodehelper_bset =cap_intersect (usermodehelper_bset, new_cap);if (table->data =CAP_PI ) usermodehelper_inheritable =cap_intersect (usermodehelper_inheritable, new_cap); +spin_unlock (&umh_sysctl_lock); } -spin_unlock (&umh_sysctl_lock);return 0 ; }
Signature · 1 line
2.14.1
Luis R. Rodriguez
maintainerQuoted 3 lines · Christophe JAILLET
If 'write' is 0, we can avoid a call to spin_lock/spin_unlock.
Signed-off-by Christophe JAILLET <[email protected]>
Sorry for the delay, I was travelling and will start nose diving now. I hope to have a concrete review and answer by tomorrow. Sorry for the two week delay on the review and thanks for the patch!
Luis
Quoted 3 lines · Christophe JAILLET
If 'write' is 0, we can avoid a call to spin_lock/spin_unlock.
Signed-off-by Christophe JAILLET <[email protected]>
Thanks for the patch!
I'll bounce a copy to Andrew for integration next.
Luis
Quoted 29 lines
--- kernel/umh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/umh.c +2
-2@@ -537,14 +537,14 @@ static int proc_cap_handler(struct ctl_table *table, int write,/* * Drop everything not in the new_cap (but don't add things) */ -spin_lock (&umh_sysctl_lock);if (write) { +spin_lock (&umh_sysctl_lock);if (table->data =CAP_BSET ) usermodehelper_bset =cap_intersect (usermodehelper_bset, new_cap);if (table->data =CAP_PI ) usermodehelper_inheritable =cap_intersect (usermodehelper_inheritable, new_cap); +spin_unlock (&umh_sysctl_lock); } -spin_unlock (&umh_sysctl_lock);return 0 ; }Signature · 1 line
2.14.1
Signature · 2 lines
Luis Rodriguez, SUSE LINUX GmbH Maxfeldstrasse 5; D-90409 Nuernberg