Frederic Weisbecker a85c2257a8 sched/isolation: add cpu_is_isolated() API
Patch series "memcg, cpuisol: do not interfere pcp cache charges draining
with cpuisol workloads".

Leonardo has reported [1] that pcp memcg charge draining can interfere
with cpu isolated workloads.  The said draining is done from a WQ context
with a pcp worker scheduled on each CPU which holds any cached charges for
a specific memcg hierarchy.  Operation is not really a common operation
[2].  It can be triggered from the userspace though so some care is
definitely due.

Leonardo has tried to address the issue by allowing remote charge draining
[3].  This approach requires an additional locking to synchronize pcp
caches sync from a remote cpu from local pcp consumers.  Even though the
proposed lock was per-cpu there is still potential for contention and less
predictable behavior.

This patchset addresses the issue from a different angle.  Rather than
dealing with a potential synchronization, cpus which are isolated are
simply never scheduled to be drained.  This means that a small amount of
charges could be laying around and waiting for a later use or they are
flushed when a different memcg is charged from the same cpu.  More details
are in patch 2.  The first patch from Frederic is implementing an
abstraction to tell whether a specific cpu has been isolated and therefore
require a special treatment.


This patch (of 2):

Provide this new API to check if a CPU has been isolated either through
isolcpus= or nohz_full= kernel parameter.

It aims at avoiding kernel load deemed to be safely spared on CPUs running
sensitive workload that can't bear any disturbance, such as pcp cache
draining.

Link: https://lkml.kernel.org/r/20230317134448.11082-1-mhocko@kernel.org
Link: https://lkml.kernel.org/r/20230317134448.11082-2-mhocko@kernel.org
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Suggested-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Leonardo Bras <leobras@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-04-18 16:29:43 -07:00
..
2023-01-16 09:26:05 +01:00
2023-02-24 17:18:54 -08:00
2023-02-27 10:04:49 -08:00
2023-02-22 11:05:56 -08:00
2023-02-16 13:42:22 +01:00
2023-02-24 15:11:03 -08:00
2023-02-24 15:11:03 -08:00
2023-02-27 09:47:26 -08:00
2023-02-25 11:30:21 -08:00
2023-02-24 17:12:23 -08:00
2023-02-27 10:04:49 -08:00
2023-02-24 17:29:52 -08:00
2023-02-24 12:58:55 -08:00
2023-02-20 09:20:55 -05:00
2023-02-24 12:58:55 -08:00
2023-02-15 19:38:50 +01:00
2023-01-19 14:46:25 +01:00
2022-12-13 10:43:59 -08:00
2023-02-03 08:20:55 -07:00
2023-01-13 11:48:15 +01:00
2023-03-05 10:49:37 -08:00
2023-02-25 11:30:21 -08:00
2023-03-25 12:57:34 -07:00
2023-01-19 16:07:40 +01:00
2023-02-24 17:18:54 -08:00
2023-01-29 15:18:33 -07:00
2023-01-29 15:18:33 -07:00
2023-02-06 19:06:58 +01:00
2022-12-13 10:33:08 -08:00
2023-01-19 09:24:28 +01:00
2023-03-13 10:14:05 +01:00
2023-01-11 06:52:43 -05:00
2023-03-19 10:02:04 -07:00
2023-02-24 12:58:55 -08:00
2022-12-13 09:47:48 -08:00
2023-02-20 12:33:41 -08:00
2023-02-24 12:58:55 -08:00
2023-02-22 12:36:25 -08:00
2023-02-22 13:50:13 -08:00
2023-02-24 14:34:12 -08:00
2022-12-16 03:54:54 -08:00
2023-02-24 14:34:12 -08:00
2023-02-13 10:11:20 +02:00
2023-01-19 09:24:28 +01:00
2023-01-19 09:24:28 +01:00
2023-01-19 09:24:30 +01:00
2023-02-23 14:05:08 -08:00
2023-02-23 14:00:10 -08:00
2023-02-22 14:21:40 -08:00
2023-02-22 14:47:20 -08:00
2023-03-15 14:58:52 +01:00
2023-02-24 13:31:53 -08:00
2023-01-16 09:26:06 +01:00
2023-02-25 11:48:02 -08:00
2023-02-23 13:43:23 +01:00
2023-01-04 14:44:13 -07:00
2023-02-21 18:24:12 -08:00
2023-01-19 09:24:28 +01:00
2022-12-20 03:13:45 +01:00
2023-02-20 17:41:08 -08:00
2023-01-19 09:24:28 +01:00
2023-01-19 15:01:19 +01:00
2023-01-03 17:49:22 -08:00
2023-01-18 17:12:47 -08:00
2023-02-16 18:10:18 +01:00
2023-03-14 17:07:54 -07:00
2023-01-23 15:38:08 +01:00
2023-02-20 19:26:58 -05:00
2023-04-05 20:03:01 -07:00
2023-01-19 09:24:28 +01:00