Re: Making rcu_normal=1 in RT
From: Paul E. McKenney <hidden>
Date: 2016-11-03 16:26:26
On Wed, Nov 02, 2016 at 05:05:47PM +0100, Sebastian Andrzej Siewior wrote:
quoted hunk ↗ jump to hunk
On 2016-11-01 05:31:56 [+0200], Michael S. Tsirkin wrote:quoted
quoted
quoted
quoted
quoted
quoted
quoted
- optionally it has been requested to make synchronize_rcu() behave like synchronize_rcu_expedited() on shutdown and kexec().I was trying to say that the fact net core calls expedited sync implies that many people care about boot time. Should rcu_normal_after_boot override rcu_expedited? I'm not sure what happens if you specify both ATM.I think what you asked for is something like this:diff --git a/kernel/reboot.c b/kernel/reboot.c --- a/kernel/reboot.c +++ b/kernel/reboot.c@@ -283,6 +283,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, struct pid_namespace *pid_ns = task_active_pid_ns(current); char buffer[256]; int ret = 0; + bool force_rcu_exp = false; /* We only trust the superuser with rebooting the system. */ if (!ns_capable(pid_ns->user_ns, CAP_SYS_BOOT))@@ -311,7 +312,19 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off) cmd = LINUX_REBOOT_CMD_HALT; + switch (cmd) { + case LINUX_REBOOT_CMD_RESTART: + case LINUX_REBOOT_CMD_HALT: + case LINUX_REBOOT_CMD_POWER_OFF: + case LINUX_REBOOT_CMD_RESTART2: + case LINUX_REBOOT_CMD_KEXEC: + force_rcu_exp = true; + } + mutex_lock(&reboot_mutex); + if (force_rcu_exp) + rcu_expedite_gp(); + switch (cmd) { case LINUX_REBOOT_CMD_RESTART: kernel_restart(NULL);@@ -362,6 +375,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, ret = -EINVAL; break; } + if (force_rcu_exp) + rcu_unexpedite_gp(); mutex_unlock(&reboot_mutex); return ret; }and problem that this patch is pointless because it is too late. This RESTART, POWER_OFF, KEXEC hooks here called once the `shutdown' binary is done doing sync & cleanup and invokes the kernel for the final operation. So to achieve what you ask for, we would need a LINUX_REBOOT_CMD_RCU_FAST option which is invoked by the `shutdown' binary as the first thing - long before it gets to LINUX_REBOOT_CMD_RESTART (or KEXEC).
FWIW, this looks sane to me. Thanx, Paul