Shakeel Butt
f689054aac
percpu_counter: add percpu_counter_sum_all interface
...
The percpu_counter is used for scenarios where performance is more
important than the accuracy. For percpu_counter users, who want more
accurate information in their slowpath, percpu_counter_sum is provided
which traverses all the online CPUs to accumulate the data. The reason it
only needs to traverse online CPUs is because percpu_counter does
implement CPU offline callback which syncs the local data of the offlined
CPU.
However there is a small race window between the online CPUs traversal of
percpu_counter_sum and the CPU offline callback. The offline callback has
to traverse all the percpu_counters on the system to flush the CPU local
data which can be a lot. During that time, the CPU which is going offline
has already been published as offline to all the readers. So, as the
offline callback is running, percpu_counter_sum can be called for one
counter which has some state on the CPU going offline. Since
percpu_counter_sum only traverses online CPUs, it will skip that specific
CPU and the offline callback might not have flushed the state for that
specific percpu_counter on that offlined CPU.
Normally this is not an issue because percpu_counter users can deal with
some inaccuracy for small time window. However a new user i.e. mm_struct
on the cleanup path wants to check the exact state of the percpu_counter
through check_mm(). For such users, this patch introduces
percpu_counter_sum_all() which traverses all possible CPUs and it is used
in fork.c:check_mm() to avoid the potential race.
This issue is exposed by the later patch "mm: convert mm's rss stats into
percpu_counter".
Link: https://lkml.kernel.org/r/20221109012011.881058-1-shakeelb@google.com
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-11-30 15:58:40 -08:00
..
2022-09-19 12:59:33 +03:00
2022-09-15 09:08:09 +02:00
2022-10-04 19:18:08 +02:00
2022-10-16 11:08:19 -07:00
2022-10-14 08:22:28 +01:00
2022-09-20 08:33:04 -07:00
2022-09-16 06:38:50 -07:00
2022-10-03 11:08:33 +01:00
2022-09-28 16:09:49 +01:00
2022-10-27 11:06:56 -07:00
2022-10-06 13:31:13 +02:00
2022-10-08 08:56:37 -07:00
2022-10-10 09:27:46 -07:00
2022-10-07 16:48:26 -07:00
2022-10-11 10:53:25 -07:00
2022-10-03 21:52:33 -07:00
2022-09-29 15:20:14 +01:00
2022-10-12 11:00:22 -07:00
2022-10-08 10:06:48 -07:00
2022-10-07 16:13:55 -07:00
2022-10-26 17:38:46 -07:00
2022-10-13 09:58:42 -07:00
2022-10-07 16:48:26 -07:00
2022-10-10 13:28:06 -07:00
2022-09-17 01:40:11 +09:00
2022-10-05 11:05:17 -06:00
2022-09-08 11:34:04 +01:00
2022-09-21 11:18:28 +09:00
2022-09-29 16:38:05 -07:00
2022-09-12 00:19:48 -06:00
2022-09-26 12:19:12 -07:00
2022-10-12 11:00:22 -07:00
2022-09-20 08:24:38 -06:00
2022-09-26 19:17:28 -06:00
2022-10-27 07:15:44 -06:00
2022-10-10 11:26:40 -06:00
2022-09-21 16:24:17 -07:00
2022-09-21 17:32:48 -07:00
2022-10-20 18:57:51 -07:00
2022-09-21 17:32:48 -07:00
2022-10-10 17:53:04 -07:00
2022-09-26 19:46:29 -07:00
2022-09-26 10:13:13 -07:00
2022-09-26 10:13:13 -07:00
2022-10-14 13:03:00 -07:00
2022-10-17 18:52:43 -07:00
2022-10-14 13:44:44 -07:00
2022-09-15 09:32:06 -07:00
2022-09-30 14:50:11 -07:00
2022-10-10 10:21:22 -07:00
2022-10-10 17:53:04 -07:00
2022-10-10 17:53:04 -07:00
2022-11-08 17:37:20 -08:00
2022-09-26 10:13:14 -07:00
2022-09-07 21:53:49 +02:00
2022-10-17 09:51:29 -04:00
2022-10-16 10:45:17 -07:00
2022-10-12 18:51:49 -07:00
2022-10-10 19:45:17 -07:00
2022-09-26 19:46:07 -07:00
2022-09-21 10:22:54 +02:00
2022-10-24 10:21:02 +02:00
2022-10-11 18:51:11 -07:00
2022-09-21 10:30:42 -06:00
2022-09-29 04:40:15 +09:00
2022-10-04 13:31:45 -07:00
2022-11-22 18:50:44 -08:00
2022-10-17 13:49:45 +02:00
2022-09-26 20:40:43 -07:00
2022-10-06 05:57:36 -07:00
2022-11-04 14:46:45 -07:00
2022-09-07 21:53:50 +02:00
2022-10-10 19:45:17 -07:00
2022-10-19 20:54:43 -07:00
2022-09-26 12:27:55 +02:00
2022-09-27 14:48:26 -04:00
2022-11-30 14:49:40 -08:00
2022-09-20 11:53:32 +01:00
2022-10-03 14:03:20 -07:00
2022-09-16 18:29:45 +08:00
2022-09-13 14:04:34 +02:00
2022-09-28 16:17:40 +01:00
2022-10-03 14:02:45 -07:00
2022-09-11 20:25:53 -07:00
2022-11-08 17:37:21 -08:00
2022-09-08 18:38:30 +02:00
2022-09-20 08:59:18 -07:00
2022-09-20 08:59:18 -07:00
2022-10-12 11:00:22 -07:00
2022-10-03 14:03:21 -07:00
2022-10-12 16:30:56 -06:00
2022-10-04 08:13:20 -06:00
2022-09-26 15:52:31 +02:00
2022-10-21 10:49:32 +02:00
2022-10-10 13:28:06 -07:00
2022-09-08 12:59:00 -06:00
2022-09-26 13:31:20 +02:00
2022-10-03 14:21:44 -07:00
2022-09-28 14:21:53 +01:00
2022-09-19 15:08:38 +02:00
2022-09-15 10:28:18 +02:00
2022-10-03 14:21:43 -07:00
2022-09-28 08:56:25 +02:00
2022-10-03 14:02:59 -07:00
2022-09-11 21:55:06 -07:00
2022-09-21 17:32:48 -07:00
2022-10-03 14:03:33 -07:00
2022-10-28 13:37:23 -07:00
2022-10-03 14:03:19 -07:00
2022-10-03 14:03:21 -07:00
2022-10-03 14:03:25 -07:00
2022-09-26 20:30:39 -07:00
2022-10-03 14:02:43 -07:00
2022-10-27 06:47:53 -04:00
2022-10-07 10:48:49 -07:00
2022-11-30 14:49:42 -08:00
2022-09-16 22:27:19 +02:00
2022-10-06 17:31:02 -07:00
2022-10-03 17:51:52 -07:00
2022-11-08 15:57:22 -08:00
2022-10-04 12:06:58 -06:00
2022-09-12 15:23:11 +03:00
2022-10-10 17:53:04 -07:00
2022-10-03 14:03:29 -07:00
2022-11-08 17:37:17 -08:00
2022-11-08 17:37:22 -08:00
2022-09-11 20:25:50 -07:00
2022-10-12 18:51:49 -07:00
2022-10-12 18:51:49 -07:00
2022-10-03 14:03:35 -07:00
2022-11-30 15:58:40 -08:00
2022-11-30 15:58:40 -08:00
2022-11-30 15:58:40 -08:00
2022-09-19 14:35:08 +02:00
2022-10-10 17:53:04 -07:00
2022-09-26 10:13:13 -07:00
2022-10-22 08:42:58 -06:00
2022-10-15 11:17:12 +01:00
2022-10-03 14:03:15 -07:00
2022-10-11 17:42:55 -06:00
2022-09-27 09:22:09 +02:00
2022-09-28 14:11:28 +01:00
2022-09-30 16:23:48 -05:00
2022-10-03 17:34:32 -07:00
2022-09-26 19:46:27 -07:00
2022-10-25 14:57:42 -07:00
2022-09-26 19:46:29 -07:00
2022-09-11 20:26:02 -07:00
2022-09-11 20:25:57 -07:00
2022-09-26 19:46:09 -07:00
2022-09-26 19:46:09 -07:00
2022-10-03 14:03:04 -07:00
2022-11-08 17:37:18 -08:00
2022-09-11 20:26:00 -07:00
2022-10-04 09:46:22 -07:00
2022-10-11 11:08:18 -07:00
2022-11-30 15:58:40 -08:00
2022-10-17 16:32:05 +02:00
2022-11-30 14:49:41 -08:00
2022-10-03 17:33:57 -07:00
2022-10-15 11:51:51 +01:00
2022-10-04 20:52:38 +02:00
2022-10-04 20:52:38 +02:00
2022-09-15 02:44:07 -07:00
2022-09-11 10:52:05 +02:00
2022-10-11 17:42:58 -06:00
2022-09-19 14:35:07 +02:00
2022-10-04 15:55:55 +02:00
2022-09-24 15:03:25 +02:00
2022-09-09 11:08:33 +02:00
2022-09-09 11:08:33 +02:00
2022-09-19 06:17:05 -07:00
2022-10-11 17:42:58 -06:00
2022-10-04 15:59:36 +02:00
2022-09-28 10:46:21 -06:00
2022-09-23 14:25:05 +02:00
2022-09-28 20:27:43 -04:00
2022-10-10 17:53:04 -07:00
2022-09-15 16:14:02 +02:00
2022-09-12 00:10:34 -06:00
2022-11-30 15:58:40 -08:00
2022-10-09 14:05:15 -07:00
2022-09-09 10:44:35 +02:00
2022-09-22 16:30:14 +02:00
2022-09-25 09:28:57 +02:00
2022-10-03 11:08:32 +01:00
2022-10-03 14:03:33 -07:00
2022-10-12 16:30:34 -06:00
2022-10-15 21:42:05 +02:00
2022-10-10 17:53:04 -07:00
2022-09-15 16:14:02 +02:00
2022-09-15 16:14:02 +02:00
2022-09-15 16:14:02 +02:00
2022-09-15 16:14:02 +02:00
2022-09-15 16:14:02 +02:00
2022-10-03 14:03:18 -07:00
2022-09-11 19:47:04 -05:00
2022-10-08 08:56:37 -07:00
2022-09-07 16:37:26 -07:00
2022-10-10 09:10:28 -07:00
2022-10-03 14:03:36 -07:00
2022-11-08 17:37:11 -08:00
2022-09-26 19:46:05 -07:00
2022-11-08 17:37:22 -08:00
2022-09-29 15:20:29 +02:00
2022-10-03 17:44:18 -07:00
2022-09-09 10:44:35 +02:00
2022-10-04 11:21:06 +02:00
2022-09-28 20:28:13 -04:00
2022-09-25 12:39:52 -04:00
2022-09-22 16:12:34 +02:00
2022-09-22 16:12:34 +02:00
2022-09-19 14:35:08 +02:00
2022-10-03 14:03:18 -07:00
2022-09-16 10:56:08 +01:00
2022-09-29 10:17:37 -04:00
2022-10-28 13:37:22 -07:00
2022-10-23 12:01:01 -07:00
2022-10-07 09:32:40 -04:00
2022-09-21 17:32:49 -07:00
2022-09-21 14:15:10 -06:00
2022-10-07 08:10:52 -06:00
2022-10-07 09:32:40 -04:00
2022-09-26 19:46:18 -07:00
2022-09-26 19:46:18 -07:00
2022-09-28 10:00:16 +02:00
2022-10-07 15:00:25 +02:00
2022-10-03 14:03:08 -07:00