s390utils/0024-s390-tools-1.8.1-cpupl...

107 lines
3.3 KiB
Diff

From 0b02dbdbd248ca51583e9dce3bd57025b965534d Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Wed, 30 Sep 2009 18:22:15 +0200
Subject: [PATCH 24/25] s390-tools-1.8.1-cpuplugd-limits
Description: cpuplugd: fix cmm_pages allocation outside min and max range
Symptom: cpuplugd might instruct CMM to operated outside the predefined limits
Problem: This problem is basically caused by a missing new line separator at
the interface between the daemon and the proc file.
Solution: Add newline to the end of each line when writing to /proc/sys/vm/cmm_pages
Problem-ID: 55472
---
cpuplugd/config.c | 15 +++++++++++++--
cpuplugd/daemon.c | 11 -----------
cpuplugd/mem.c | 6 +++---
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/cpuplugd/config.c b/cpuplugd/config.c
index c013a65..bd3cb43 100644
--- a/cpuplugd/config.c
+++ b/cpuplugd/config.c
@@ -494,7 +494,7 @@ void check_config(struct config *cfg)
if (memory == 1) {
/*
* check that the initial value of cmm_pages is not below
- * cmm_min
+ * cmm_min or above cmm_max
*/
cmm_pagesize_start = get_cmmpages_size();
if (cmm_pagesize_start < cfg->cmm_min) {
@@ -506,7 +506,18 @@ void check_config(struct config *cfg)
syslog(LOG_INFO, "cmm_pages is below minimum "
"and will be increased\n");
}
- memunplug(cfg->cmm_min);
+ set_cmm_pages(cfg->cmm_min);
+ }
+ if (cmm_pagesize_start > cfg->cmm_max) {
+ if (debug && foreground == 1) {
+ printf("cmm_pages is above the maximum and will "
+ "be decreased.\n");
+ }
+ if (debug && foreground == 0) {
+ syslog(LOG_INFO, "cmm_pages is above the maximum "
+ "and will be decreased\n");
+ }
+ set_cmm_pages(cfg->cmm_max);
}
}
}
diff --git a/cpuplugd/daemon.c b/cpuplugd/daemon.c
index d0769f3..e1ef623 100644
--- a/cpuplugd/daemon.c
+++ b/cpuplugd/daemon.c
@@ -260,17 +260,6 @@ void check_max(struct config *cfg)
cpuid++;
}
}
- if (memory && get_cmmpages_size() > cfg->cmm_max) {
- if (debug && foreground == 1) {
- printf("cmm_pages is above the maximum and will "
- "be decreased.\n");
- }
- if (debug && foreground == 0) {
- syslog(LOG_INFO, "cmm_pages is above the maximum "
- "and will be decreased\n");
- }
- set_cmm_pages(cfg->cmm_max);
- }
}
/* check if we are running in an LPAR environment.
diff --git a/cpuplugd/mem.c b/cpuplugd/mem.c
index 2f3d219..6200904 100644
--- a/cpuplugd/mem.c
+++ b/cpuplugd/mem.c
@@ -138,7 +138,7 @@ int memunplug(int size)
":%s\n", strerror(errno));
return -1;
}
- fprintf(filp, "%d", new_size);
+ fprintf(filp, "%d\n", new_size);
if (debug && foreground == 1)
printf("changed number of pages permanently reserved "
"to %d \n", new_size);
@@ -173,7 +173,7 @@ int memplug(int size)
":%s\n", strerror(errno));
return -1;
}
- fprintf(filp, "%d", new_size);
+ fprintf(filp, "%d\n", new_size);
if (debug && foreground == 1)
printf("changed number of pages permanently reserved "
"to %d \n", new_size);
@@ -200,7 +200,7 @@ int set_cmm_pages(int size)
":%s\n", strerror(errno));
return -1;
}
- fprintf(filp, "%d", size);
+ fprintf(filp, "%d\n", size);
if (debug && foreground == 1)
printf("changed number of pages permanently reserved "
"to %d \n", size);
--
1.6.3.3