Tuesday, June 7, 2016

[389-commits] 2 commits - ldap/servers

ldap/servers/slapd/backend_manager.c | 1 +
ldap/servers/slapd/daemon.c | 2 +-
ldap/servers/slapd/plugin.c | 12 +++++++++---
ldap/servers/slapd/proto-slap.h | 1 +
ldap/servers/slapd/util.c | 33 ++++++---------------------------
5 files changed, 18 insertions(+), 31 deletions(-)

New commits:
commit 0f4f838b29df3e33bf0751c80baf2d4e052856ef
Author: William Brown <firstyear@redhat.com>
Date: Thu Jun 2 11:04:05 2016 +1000

Ticket 48863 - remove check for vmsize from util_info_sys_pages

Bug Description: https://bugzilla.redhat.com/show_bug.cgi?id=1341709 and
on another instance could not allocate cache because it would exceed memory size

In both cases I suspect that that vmsize was low, and this causes the
util_info_sys_pages check to return a low pages number, which triggers the
checking to fail

Fix Description: Remove the checks related to vmsize. It's either too low,
or just too high and wrong. Either way, we never rely on it. Lets use reliable
data.

https://fedorahosted.org/389/ticket/48863

Author: wibrown

Review by: nhosoi (Thanks!)

diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 89c7579..3f17461 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1538,7 +1538,7 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
* This space is a "funny number". It's a best effort based system
* where linux instead of telling us how much memory *actually* exists
* for us to use, gives us a virtual memory allocation which is the
- * value of ram + swap.
+ * value of ram + swap.... sometimes. Depends on platform.
*
* But none of these pages even exist or belong to us on the real system
* until will malloc them AND write a non-zero to them.
@@ -1569,13 +1569,12 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
* potentially allocate: generally, this will be MemAvailable.
*/

- size_t vmsize = 0;
size_t freesize = 0;
size_t rlimsize = 0;

*pagesize = getpagesize();

- /* Get the amount of freeram, rss, and the vmsize */
+ /* Get the amount of freeram, rss */

FILE *f;
char fn[40], s[80];
@@ -1596,9 +1595,6 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
/* VmRSS shows us what we are ACTUALLY using for proc pages
* Rather than "funny" pages.
*/
- if (strncmp(s, "VmSize:", 7) == 0) {
- sscanf(s+7, "%lu", (long unsigned int *)&vmsize);
- }
if (strncmp(s, "VmRSS:", 6) == 0) {
sscanf(s+6, "%lu", (long unsigned int *)procpages);
}
@@ -1641,29 +1637,11 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
/* This is in bytes, make it pages */
rlimsize = rlimsize / *pagesize;
}
- /* Now we have vmsize, the availpages from getrlimit, our freesize */
- vmsize /= (*pagesize / 1024);

- /* Pages is the total ram on the system. We should smaller of:
- * - vmsize
- * - pages
- */
- LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, vmsize=%lu, \n",
- (unsigned long) *pages, (unsigned long) vmsize,0);
-#if __GNUC__
-#if __x86_64__ || __ppc64__
- /* On 64bit platforms, vmsize is set high (VmSize), and doesn't change. IE 17tb */
- if (vmsize < *pages) {
- LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using vmsize for pages \n",0,0,0);
- *pages = vmsize;
- } else {
- LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
- }
-#else
- /* On 32bit platforms, vmsize is set low (VmSize) and grows. */
+ /* Pages is the total ram on the system. */
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, \n",
+ (unsigned long) *pages, 0,0);
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
-

No comments:

Post a Comment