|
|
b045b9 |
From 9369164f45ba19519158286590aaefae1c64ef05 Mon Sep 17 00:00:00 2001
|
|
|
b045b9 |
From: William Brown <firstyear@redhat.com>
|
|
|
b045b9 |
Date: Thu, 5 Oct 2017 09:54:48 +1000
|
|
|
b045b9 |
Subject: [PATCH] Ticket 49392 - memavailable not available
|
|
|
b045b9 |
|
|
|
b045b9 |
Bug Description: On certain linux platforms memAvailable is
|
|
|
b045b9 |
not actually available! This means that the value was 0, so
|
|
|
b045b9 |
cgroup max was read instead, setting the system ram to:
|
|
|
b045b9 |
|
|
|
b045b9 |
9223372036854771712
|
|
|
b045b9 |
|
|
|
b045b9 |
That's a bit excessive, and can cause memory allocations to fail.
|
|
|
b045b9 |
|
|
|
b045b9 |
Fix Description: If memavail can't be found, fall back to
|
|
|
b045b9 |
memtotal instead.
|
|
|
b045b9 |
|
|
|
b045b9 |
https://pagure.io/389-ds-base/issue/49392
|
|
|
b045b9 |
|
|
|
b045b9 |
Author: wibrown
|
|
|
b045b9 |
|
|
|
b045b9 |
Review by: mreynolds (Thanks!)
|
|
|
b045b9 |
---
|
|
|
b045b9 |
ldap/servers/slapd/slapi_pal.c | 11 ++++++++++-
|
|
|
b045b9 |
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
b045b9 |
|
|
|
b045b9 |
diff --git a/ldap/servers/slapd/slapi_pal.c b/ldap/servers/slapd/slapi_pal.c
|
|
|
b045b9 |
index 38c178cfa..600d03d4d 100644
|
|
|
b045b9 |
--- a/ldap/servers/slapd/slapi_pal.c
|
|
|
b045b9 |
+++ b/ldap/servers/slapd/slapi_pal.c
|
|
|
b045b9 |
@@ -155,7 +155,16 @@ spal_meminfo_get()
|
|
|
b045b9 |
|
|
|
b045b9 |
/* Both memtotal and memavail are in kb */
|
|
|
b045b9 |
memtotal = memtotal * 1024;
|
|
|
b045b9 |
- memavail = memavail * 1024;
|
|
|
b045b9 |
+
|
|
|
b045b9 |
+ /*
|
|
|
b045b9 |
+ * Oracle Enterprise Linux doesn't provide a valid memavail value, so fall
|
|
|
b045b9 |
+ * back to 80% of memtotal.
|
|
|
b045b9 |
+ */
|
|
|
b045b9 |
+ if (memavail == 0) {
|
|
|
b045b9 |
+ memavail = memtotal * 0.8;
|
|
|
b045b9 |
+ } else {
|
|
|
b045b9 |
+ memavail = memavail * 1024;
|
|
|
b045b9 |
+ }
|
|
|
b045b9 |
|
|
|
b045b9 |
/* If it's possible, get our cgroup info */
|
|
|
b045b9 |
uint64_t cg_mem_soft = 0;
|
|
|
b045b9 |
--
|
|
|
b045b9 |
2.13.6
|
|
|
b045b9 |
|