File kdump-fate318842-0006-improve-small-x86_64.patch of Package kdump

From: Petr Tesarik <ptesarik@suse.com>
Date: Fri Sep 25 16:45:55 2015 +0200
Subject: Improve calibrate on small x86_64 systems
References: FATE#318842, bsc#947539
Patch-mainline: v0.8.16
Git-commit: f585a7fea2e75c3f98ad2ff020c83dd826e98741

On systems where "high" allocation is actually below 4G (e.g. systems
with up to 4G of RAM), the "low" allocation is skipped completely.
It is possible to specify everything "low", and it gets translated
to "crashkernel=xxxM" on the kernel command line. However, this gets
interpreted by the kernel as "allocate xxxM below 896M", rather than
"allocate xxxM below 4G".

It seems that on such systems, everything should be allocated "high".
Because such allocation is still limited by available RAM, it will
end up "low".

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

---
 kdumptool/calibrate.cc |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -1007,25 +1007,27 @@ void Calibrate::execute()
     }
 
     cout << "Total: " << (memtotal >> 10) << endl;
+
 #if defined(__x86_64__)
     unsigned long long base = mm.find(required << 10, 16UL << 20);
+    unsigned long low, high;
     if (base < (1ULL<<32)) {
-	cout << "Low: " << shr_round_up(required, 10) << endl;
-	cout << "High: 0" << endl;
+	low = 0;
+	high = required;
     } else {
-	cout << "Low: 72" << endl;
-	cout << "High: " << (shr_round_up(required, 10) - 72) << endl;
+	low = MINLOW_KB;
+	high = (required > low ? required - low : 0);
     }
-#else
-    cout << "Low: " << shr_round_up(required, 10) << endl;
-    cout << "High: 0" << endl;
-#endif
-    cout << "MinLow: " << shr_round_up(MINLOW_KB, 10) << endl;
-#if defined(__x86_64__)
+    cout << "Low: " << shr_round_up(low, 10) << endl;
+    cout << "High: " << shr_round_up(high, 10) << endl;
+    cout << "MinLow: " << shr_round_up(low, 10) << endl;
     cout << "MaxLow: " << (mm.largest(1ULL<<32) >> 20) << endl;
     cout << "MinHigh: 0" << endl;
     cout << "MaxHigh: " << (mm.largest() >> 20) << endl;
 #else
+    cout << "Low: " << shr_round_up(required, 10) << endl;
+    cout << "High: 0" << endl;
+    cout << "MinLow: " << shr_round_up(MINLOW_KB, 10) << endl;
 # if defined(__i386__)
     cout << "MaxLow: " << (mm.largest(512ULL<<20) >> 20) << endl;
 # else
openSUSE Build Service is sponsored by