I'm off in a few days for a couple months of tourism in Europe (no, no need
for sympathy!), so I'm dumping these couple ideas on you and running.

I think shutdown time has gotten uglier and slower than it needs to be.
I want to apply these patches (well, at least the first one) before I escape
radar range.  Your job is to not object much. :-)

Patch 1 replaces:

  Waiting (max 60 seconds) for system process `bufdaemon' to stop...stopped


  Stopping bufdaemon


  syncing disks... 10 10 3

returns to the traditional

  syncing disks... 10 10 3 done

Patch 2 is smaller and possibly controversial.  Normally bufdaemon and
syncer are sleeping when they are told to suspend.  This delays shutdown
by a few boring seconds.  With this patch, it is zippier.  I expect people
to complain about this shortcut, but every sleeping process should expect
to be woken for no reason at all.  Basic kernel premise.

I've been running these patches on a 4.x machine for a while now.  No
problems except I am now surprised by the slow and ugly shutdown of
unpatched machines. :-)

I apologise that I've not tested these against -current.  That's the bit
that I've skipped because I'm out of time.  There should be no difference
between 4.x and -current in this area though.  These patches will apply
cleanly against both.



Patch 1:
Index: kern_shutdown.c
RCS file: /cvs/src/sys/kern/kern_shutdown.c,v
retrieving revision 1.76
diff -u -r1.76 kern_shutdown.c
--- kern_shutdown.c     2000/07/04 11:25:22     1.76
+++ kern_shutdown.c     2000/07/06 15:02:21
@@ -247,7 +247,6 @@
                        sync(&proc0, NULL);
                        DELAY(50000 * iter);
-               printf("\n");
                 * Count only busy local buffers to prevent forcing 
                 * a fsck if we're just a client of a wedged NFS server
@@ -261,6 +260,8 @@
                                            bp->b_vp->v_mount, mnt_list);
+                               if (nbusy == 0)
+                                       printf("\n");
 #if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC)
@@ -593,12 +594,11 @@
        p = (struct proc *)arg;
-       printf("Waiting (max %d seconds) for system process `%s' to stop...",
-           kproc_shutdown_wait, p->p_comm);
+       printf("Stopping %s", p->p_comm);
        error = suspend_kproc(p, kproc_shutdown_wait * hz);
        if (error == EWOULDBLOCK)
-               printf("timed out\n");
+               printf(": timed out\n");
-               printf("stopped\n");
+               printf("\n");

Patch 2:
Index: kern_kthread.c
RCS file: /cvs/src/sys/kern/kern_kthread.c,v
retrieving revision 1.5
diff -u -r1.5 kern_kthread.c
--- kern_kthread.c      2000/01/10 08:00:58     1.5
+++ kern_kthread.c      2000/08/05 15:32:06
@@ -116,6 +116,12 @@
        if ((p->p_flag & P_SYSTEM) == 0)
                return (EINVAL);
+       /*
+        * The target process is probably just snoozing.  Wake it up so
+        * that it will notice that it should suspend itself.
+        */
+       if (p->p_wchan != NULL)
+               wakeup(p->p_wchan);
        SIGADDSET(p->p_siglist, SIGSTOP);
        return tsleep((caddr_t)&p->p_siglist, PPAUSE, "suspkp", timo);


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to