提交 ce0a568d 编写于 作者: A Anna-Maria Gleixner 提交者: Linus Torvalds

userns: use irqsave variant of refcount_dec_and_lock()

The irqsave variant of refcount_dec_and_lock handles irqsave/restore when
taking/releasing the spin lock.  With this variant the call of
local_irq_save/restore is no longer required.

[bigeasy@linutronix.de: s@atomic_dec_and_lock@refcount_dec_and_lock@g]
Link: http://lkml.kernel.org/r/20180703200141.28415-7-bigeasy@linutronix.deSigned-off-by: NAnna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fc371912
...@@ -169,11 +169,8 @@ void free_uid(struct user_struct *up) ...@@ -169,11 +169,8 @@ void free_uid(struct user_struct *up)
if (!up) if (!up)
return; return;
local_irq_save(flags); if (refcount_dec_and_lock_irqsave(&up->__count, &uidhash_lock, &flags))
if (refcount_dec_and_lock(&up->__count, &uidhash_lock))
free_user(up, flags); free_user(up, flags);
else
local_irq_restore(flags);
} }
struct user_struct *alloc_uid(kuid_t uid) struct user_struct *alloc_uid(kuid_t uid)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册