[patch 1/5] sched: isolation: introduce vmstat_sync isolcpu flags
From: Marcelo Tosatti
Date: Thu Jul 01 2021 - 17:06:36 EST
Add a new isolcpus flag "vmstat_sync" to control whether
to sync per-CPU counters to global counters when returning
to userspace.
Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
Index: linux-2.6-vmstat-update/include/linux/sched/isolation.h
===================================================================
--- linux-2.6-vmstat-update.orig/include/linux/sched/isolation.h
+++ linux-2.6-vmstat-update/include/linux/sched/isolation.h
@@ -15,6 +15,7 @@ enum hk_flags {
HK_FLAG_WQ = (1 << 6),
HK_FLAG_MANAGED_IRQ = (1 << 7),
HK_FLAG_KTHREAD = (1 << 8),
+ HK_FLAG_VMSTAT_SYNC = (1 << 9),
};
#ifdef CONFIG_CPU_ISOLATION
Index: linux-2.6-vmstat-update/kernel/sched/isolation.c
===================================================================
--- linux-2.6-vmstat-update.orig/kernel/sched/isolation.c
+++ linux-2.6-vmstat-update/kernel/sched/isolation.c
@@ -173,6 +173,12 @@ static int __init housekeeping_isolcpus_
continue;
}
+ if (!strncmp(str, "vmstat_sync,", 12)) {
+ str += 12;
+ flags |= HK_FLAG_VMSTAT_SYNC;
+ continue;
+ }
+
/*
* Skip unknown sub-parameter and validate that it is not
* containing an invalid character.
Index: linux-2.6-vmstat-update/Documentation/admin-guide/kernel-parameters.txt
===================================================================
--- linux-2.6-vmstat-update.orig/Documentation/admin-guide/kernel-parameters.txt
+++ linux-2.6-vmstat-update/Documentation/admin-guide/kernel-parameters.txt
@@ -2124,6 +2124,23 @@
The format of <cpu-list> is described above.
+ vmstat_sync
+
+ Page counters are maintained in per-CPU counters to
+ improve performance. When a CPU modifies a page counter,
+ this modification is kept in the per-CPU counter.
+ Certain activities require a global count, which
+ involves requesting each CPU to flush its local counters
+ to the global VM counters.
+ This flush is implemented via a workqueue item, which
+ requires scheduling the workqueue task on isolated CPUs.
+
+ To avoid this interruption, this option syncs the
+ page counters on each return from system calls.
+ To ensure the application returns to userspace
+ with no modified per-CPU counters, its necessary to
+ use mlockall() in addition to this isolcpus flag.
+
iucv= [HW,NET]
ivrs_ioapic [HW,X86-64]