Re: Making rcu_normal=1 in RT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2016-11-01 05:31:56 [+0200], Michael S. Tsirkin wrote:
> > > > > > 
> > > > > > > - 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).

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux