File kdump-multithreading-by-default.patch of Package kdump.21349

From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Jun 23 13:47:28 2017 +0200
Subject: Multithreading by default
References: bsc#1036223
Upstream: v0.8.17
Git-commit: 07534f44546e37c65a08fe7fb093255fbca6cd30

The "--num-threads" and "--split" makedumpfile options are mutually
exclusive. Before multithreading was implemented, "--split" was the
only way to use any additional CPUs. It makes more sense to use
multithreading by default.

To use "--split", the SPLIT flag can be specified.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>

---
 doc/man/kdump.5.txt.in |   16 +++++++++++-----
 kdumptool/savedump.cc  |   17 +++++++++++++++++
 kdumptool/savedump.h   |    1 +
 sysconfig.kdump.in     |    5 +++--
 4 files changed, 32 insertions(+), 7 deletions(-)

--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -513,11 +513,17 @@ This is a space-separated list of flags
   Because SFTP and FTP are not mounted, that option has no meaning when saving
   the dump to SFTP and FTP.
 
-*NOSPLIT*::
-  Disable the _--split_ option of *makedumpfile*(8). This option is normally
-  added when KDUMP_CPUS>1, because otherwise the additional CPUs are idle.
-  You can specify this flag to force the use of only one dumping process,
-  regardless of the value of KDUMP_CPUS.
+*SPLIT*::
+  If KDUMP_CPUS>1, use the _--split_ option of *makedumpfile*(8) instead of
+  the default _--num-threads_.
+
+*SINGLE*::
+  Specify this flag to force the use of only one CPU for dumping, regardless
+  of the value of KDUMP_CPUS.
+  It disables the _--split_ and _--num-threads_ options of *makedumpfile*(8).
+
+  For compatibility with older versions, *NOSPLIT* is an alias for *SINGLE*.
+  Its use is deprecated.
 
 *XENALLDOMAINS*::
   When dumping a Xen virtualization host, *makedumpfile*(8) is normally
--- a/kdumptool/savedump.cc
+++ b/kdumptool/savedump.cc
@@ -291,11 +291,24 @@ void SaveDump::saveDump(const RootDirURL
         cpus = syscpu.numOnline();
     }
     if (!config->kdumptoolContainsFlag("NOSPLIT") &&
+        !config->kdumptoolContainsFlag("SINGLE") &&
         cpus > 1) {
 	if (!useElf)
 	    m_split = cpus;
 	else
 	    cerr << "Splitting ELF dumps is not supported." << endl;
+
+        if (config->kdumptoolContainsFlag("SPLIT")) {
+            if (!useElf)
+                m_split = cpus;
+            else
+                cerr << "Splitting ELF dumps is not supported." << endl;
+        } else {
+            if (!useElf)
+                m_threads = cpus - 1;
+            else
+                cerr << "Multithreading is unavailable for ELF dumps" << endl;
+        }
     }
 
     bool excludeDomU = false;
@@ -313,6 +326,10 @@ void SaveDump::saveDump(const RootDirURL
         cmdline << "makedumpfile ";
 	if (m_split)
 	    cmdline << "--split ";
+        if (m_threads) {
+	    SystemCPU syscpu;
+            cmdline << "--num-threads " << m_threads << " ";
+        }
         cmdline << config->MAKEDUMPFILE_OPTIONS.value() << " ";
         cmdline << "-d " << config->KDUMP_DUMPLEVEL.value() << " ";
 	if (excludeDomU)
--- a/kdumptool/savedump.h
+++ b/kdumptool/savedump.h
@@ -113,6 +113,7 @@ class SaveDump : public Subcommand {
         bool m_usedDirectSave;
         bool m_useMakedumpfile;
 	unsigned long m_split;
+	unsigned long m_threads;
         std::string m_crashtime;
         std::string m_crashrelease;
         std::string m_rootdir;
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -271,14 +271,15 @@ KDUMP_POSTSCRIPT=""
 #
 KDUMP_COPY_KERNEL="yes"
 
-## Type:        string(NOSPARSE,NOSPLIT,XENALLDOMAINS)
+## Type:        string(NOSPARSE,SPLIT,SINGLE,XENALLDOMAINS)
 ## Default:     ""
 ## ServiceRestart:	kdump
 #
 # Space-separated list of flags to tweak the run-time behaviour of kdumptool:
 #
 #   NOSPARSE disable creation of sparse files.
-#   NOSPLIT  do not pass "--split" to makedumpfile even if KDUMP_CPUS > 1
+#   SPLIT    split the dump file with "makedumpfile --split"
+#   SINGLE   use single CPU to save the dump
 #   XENALLDOMAINS do not filter out Xen DomU pages
 #
 # See also: kdump(5).
openSUSE Build Service is sponsored by