NetBSD-Bugs archive

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

Re: misc/50046: Slow rc multiuser boot in 7.0 and current



On Sun, 12 Jul 2015, frank%phoenix.owl.de@localhost wrote:
Description:
Since the workaround for PR 48714 the multiuser boot in 7.0 and current has become very slow, which especially affects smaller single-CPU platforms.

I suspect the tests in the _have_rc_postprocessor function in rc.subr.
There are even comments saying that they are expensive.

Please try the appended patch.

--apb (Alan Barrett)

Index: etc/rc.subr
===================================================================
--- rc.subr	7 Oct 2014 19:09:45 -0000	1.96
+++ rc.subr	12 Aug 2015 06:14:04 -0000
@@ -814,19 +814,9 @@ $command $rc_flags $command_args"
_have_rc_postprocessor()
{
	# Cheap tests that fd and pid are set, fd is writable.
-	[ -n "${_rc_postprocessor_fd}" ] || return 1
-	[ -n "${_rc_pid}" ] || return 1
-	eval ": >&${_rc_postprocessor_fd}" 2>/dev/null || return 1
-
-	# More expensive test that pid is running.
-	# Unset _rc_pid if this fails.
-	kill -0 "${_rc_pid}" 2>/dev/null \
-	|| { unset _rc_pid; return 1; }
-
-	# More expensive test that pid appears to be
-	# a shell running an rc script.
-	# Unset _rc_pid if this fails.
-	expr "$(ps -p "${_rc_pid}" -o command=)" : ".*sh .*/rc.*" >/dev/null \
+	[ -n "${_rc_pid}" ] || { unset _rc_pid; return 1; }
+	[ -n "${_rc_postprocessor_fd}" ] || { unset _rc_pid; return 1; }
+	eval ": >&${_rc_postprocessor_fd}" 2>/dev/null \
	|| { unset _rc_pid; return 1; }

	return 0


Home | Main Index | Thread Index | Old Index