]> git.baikalelectronics.ru Git - kernel.git/commit
Use atomic_t for ucounts reference counting
authorAlexey Gladkov <legion@kernel.org>
Thu, 22 Apr 2021 12:27:10 +0000 (14:27 +0200)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 30 Apr 2021 19:14:01 +0000 (14:14 -0500)
commit038120c810143d5759dd43b3f82d11bfa7ff146c
tree2bf2101c651ec8bb6de80cf738b0cf76a7c40374
parentf1a16397110127aa51b6a99fccf03b116ac8cdd6
Use atomic_t for ucounts reference counting

The current implementation of the ucounts reference counter requires the
use of spin_lock. We're going to use get_ucounts() in more performance
critical areas like a handling of RLIMIT_SIGPENDING.

Now we need to use spin_lock only if we want to change the hashtable.

v10:
* Always try to put ucounts in case we cannot increase ucounts->count.
  This will allow to cover the case when all consumers will return
  ucounts at once.

v9:
* Use a negative value to check that the ucounts->count is close to
  overflow.

Signed-off-by: Alexey Gladkov <legion@kernel.org>
Link: https://lkml.kernel.org/r/94d1dbecab060a6b116b0a2d1accd8ca1bbb4f5f.1619094428.git.legion@kernel.org
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
include/linux/user_namespace.h
kernel/ucount.c