Author: jtl
Date: Fri Apr  6 17:06:22 2018
New Revision: 332117
URL: https://svnweb.freebsd.org/changeset/base/332117

Log:
  Pat the watchdog less while producing a coredump.  Prior to this change,
  we patted the watchdog approximately once per 4KB page of memory.  After
  this change, we pat the watchdog approximately once per 128MB of memory.
  On a sample machine, this translated to patting the watchdog approximately
  every 5.4 seconds, which "seems reasonable". We can choose a different
  value in the future, if warranted.
  
  This has extensive field experience. It is a performance improvement, and
  has not caused any known problems.
  
  Reviewed by:  imp, kib
  Sponsored by: Netflix, Inc.
  Differential Revision:        https://reviews.freebsd.org/D14988

Modified:
  head/sys/amd64/amd64/minidump_machdep.c

Modified: head/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- head/sys/amd64/amd64/minidump_machdep.c     Fri Apr  6 17:04:21 2018        
(r332116)
+++ head/sys/amd64/amd64/minidump_machdep.c     Fri Apr  6 17:06:22 2018        
(r332117)
@@ -62,7 +62,7 @@ static struct kerneldumpheader kdh;
 /* Handle chunked writes. */
 static size_t fragsz;
 static void *dump_va;
-static size_t counter, progress, dumpsize;
+static size_t counter, progress, dumpsize, wdog_next;
 
 CTASSERT(sizeof(*vm_page_dump) == 8);
 static int dump_retry_count = 5;
@@ -134,6 +134,9 @@ report_progress(size_t progress, size_t dumpsize)
        }
 }
 
+/* Pat the watchdog approximately every 128MB of the dump. */
+#define        WDOG_DUMP_INTERVAL      (128 * 1024 * 1024)
+
 static int
 blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 {
@@ -173,9 +176,14 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t
                        report_progress(progress, dumpsize);
                        counter &= (1<<24) - 1;
                }
+               if (progress <= wdog_next) {
+                       wdog_kern_pat(WD_LASTVAL);
+                       if (wdog_next > WDOG_DUMP_INTERVAL)
+                               wdog_next -= WDOG_DUMP_INTERVAL;
+                       else
+                               wdog_next = 0;
+               }
 
-               wdog_kern_pat(WD_LASTVAL);
-
                if (ptr) {
                        error = dump_append(di, ptr, 0, len);
                        if (error)
@@ -313,7 +321,7 @@ minidumpsys(struct dumperinfo *di)
        }
        dumpsize += PAGE_SIZE;
 
-       progress = dumpsize;
+       wdog_next = progress = dumpsize;
 
        /* Initialize mdhdr */
        bzero(&mdhdr, sizeof(mdhdr));
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to