Files
linux/include/linux
Barret Rhoden 18c91bb2d8 prlimit: do not grab the tasklist_lock
Unnecessarily grabbing the tasklist_lock can be a scalability bottleneck
for workloads that also must grab the tasklist_lock for waiting,
killing, and cloning.

The tasklist_lock was grabbed to protect tsk->sighand from disappearing
(becoming NULL).  tsk->signal was already protected by holding a
reference to tsk.

update_rlimit_cpu() assumed tsk->sighand != NULL.  With this commit, it
attempts to lock_task_sighand().  However, this means that
update_rlimit_cpu() can fail.  This only happens when a task is exiting.
Note that during exec, sighand may *change*, but it will not be NULL.

Prior to this commit, the do_prlimit() ensured that update_rlimit_cpu()
would not fail by read locking the tasklist_lock and checking tsk->sighand
!= NULL.

If update_rlimit_cpu() fails, there may be other tasks that are not
exiting that share tsk->signal.  However, the group_leader is the last
task to be released, so if we cannot update_rlimit_cpu(group_leader),
then the entire process is exiting.

The only other caller of update_rlimit_cpu() is
selinux_bprm_committing_creds().  It has tsk == current, so
update_rlimit_cpu() cannot fail (current->sighand cannot disappear
until current exits).

This change resulted in a 14% speedup on a microbenchmark where parents
kill and wait on their children, and children getpriority, setpriority,
and getrlimit.

Signed-off-by: Barret Rhoden <brho@google.com>
Link: https://lkml.kernel.org/r/20220106172041.522167-4-brho@google.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2022-03-08 14:33:36 -06:00
..
2021-09-20 12:43:34 +01:00
2021-08-29 14:47:42 +03:00
2022-01-22 08:33:34 +02:00
2021-10-07 16:51:57 +02:00
2022-01-15 08:47:31 -08:00
2021-10-18 14:43:23 -06:00
2022-01-09 10:36:51 -07:00
2021-11-12 10:19:09 -08:00
2021-11-17 10:36:15 -05:00
2021-09-08 15:32:35 -07:00
2021-12-10 17:10:55 -08:00
2021-12-10 12:51:28 +01:00
2021-12-01 00:06:43 +01:00
2021-08-26 15:32:28 -04:00
2021-07-27 11:00:36 +02:00
2021-09-06 07:20:56 -04:00
2022-01-15 08:47:31 -08:00
2021-06-25 19:57:01 -04:00
2021-07-26 15:09:44 +02:00
2022-01-20 08:52:54 +02:00
2021-07-27 20:11:45 +01:00
2021-07-27 20:11:44 +01:00
2021-10-18 07:49:38 -04:00
2022-01-04 13:15:33 -05:00
2021-08-05 11:46:42 +01:00
2021-12-17 09:06:15 +01:00
2021-12-20 09:03:05 +01:00
2021-10-05 06:54:16 -05:00
2021-07-27 17:05:06 +01:00
2021-10-18 07:49:39 -04:00
2021-09-30 12:46:44 -06:00
2021-07-01 11:06:05 -07:00
2021-12-16 22:22:20 +01:00
2021-08-23 13:19:12 +02:00
2021-09-21 13:44:55 -07:00
2022-02-09 09:24:40 -05:00
2022-01-12 10:14:09 -06:00
2021-11-16 19:07:53 -08:00
2021-09-17 13:52:17 +01:00
2021-09-27 09:27:29 -04:00
2021-09-27 17:00:21 +02:00
2021-07-06 10:37:46 -05:00
2021-10-14 13:29:18 +02:00
2021-08-18 22:08:24 +02:00
2022-01-22 08:33:37 +02:00
2022-01-08 12:43:57 -06:00
2021-11-18 09:36:39 +01:00
2021-10-07 16:51:57 +02:00
2022-01-24 14:45:02 +01:00
2021-11-30 17:25:20 -08:00
2022-03-08 14:33:36 -06:00
2021-10-18 07:49:39 -04:00
2021-10-18 17:20:50 +02:00
2022-01-22 08:33:37 +02:00
2022-01-22 08:33:38 +02:00
2021-11-16 13:10:34 +00:00
2021-10-26 14:58:45 +01:00
2021-08-06 13:41:48 -07:00
2021-08-19 09:02:55 +09:00
2021-11-03 11:41:25 -07:00
2021-07-01 11:06:03 -07:00
2021-11-25 18:35:23 +01:00
2021-09-08 15:32:35 -07:00
2021-10-12 11:41:39 -03:00
2021-12-30 12:13:04 +01:00
2022-01-14 18:50:52 -05:00
2021-08-11 06:44:24 -04:00
2021-12-09 10:49:56 -08:00
2022-01-08 00:28:41 -05:00
2021-10-19 23:44:30 +08:00