70 lines
2.1 KiB
Diff
70 lines
2.1 KiB
Diff
From f127d0df43f5fe5709f068e0c79bef0b759cb6fe Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
|
|
Date: Fri, 28 Jan 2011 14:28:35 +0100
|
|
Subject: [PATCH 59/61] cpuplugd: cmm_pages not set and restored correctly
|
|
|
|
Description: cpuplugd: cmm_pages not set and restored correctly
|
|
Symptom: /proc/sys/vm/cmm_pages will be restored to 0 after program exit,
|
|
regardless of previous value, if cpuplugd is run with an invalid
|
|
memory configuration, e.g. cmm_min commented out. Also, cmm_pages
|
|
will not correctly reach a cmm_min of 0 during run-time, in a case
|
|
where cmm_pages is equal to cmm_inc.
|
|
Problem: Incorrect checks on program exit, and in the memplug function.
|
|
Solution: Fix checks on program exit and memplug.
|
|
---
|
|
cpuplugd/config.c | 1 +
|
|
cpuplugd/daemon.c | 4 ++--
|
|
cpuplugd/mem.c | 2 +-
|
|
3 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/cpuplugd/config.c b/cpuplugd/config.c
|
|
index e853ea7..bda7780 100644
|
|
--- a/cpuplugd/config.c
|
|
+++ b/cpuplugd/config.c
|
|
@@ -358,6 +358,7 @@ void check_config(struct config *cfg)
|
|
if (foreground == 0)
|
|
syslog(LOG_INFO, "No valid memory hotplug "
|
|
"configuration detected\n");
|
|
+ memory = 0;
|
|
} else {
|
|
memory = 1;
|
|
/*
|
|
diff --git a/cpuplugd/daemon.c b/cpuplugd/daemon.c
|
|
index 391acba..4dab372 100644
|
|
--- a/cpuplugd/daemon.c
|
|
+++ b/cpuplugd/daemon.c
|
|
@@ -125,7 +125,7 @@ void clean_up()
|
|
syslog(LOG_INFO, "terminated\n");
|
|
remove(pid_file);
|
|
reactivate_cpus();
|
|
- if (check_cmmfiles() == 0)
|
|
+ if (memory)
|
|
cleanup_cmm();
|
|
exit(1);
|
|
}
|
|
@@ -139,7 +139,7 @@ void kill_daemon(int a)
|
|
syslog(LOG_INFO, "shutting down\n");
|
|
remove(pid_file);
|
|
reactivate_cpus();
|
|
- if (check_cmmfiles() == 0)
|
|
+ if (memory)
|
|
cleanup_cmm();
|
|
exit(0);
|
|
}
|
|
diff --git a/cpuplugd/mem.c b/cpuplugd/mem.c
|
|
index 13f902d..b15c7e2 100644
|
|
--- a/cpuplugd/mem.c
|
|
+++ b/cpuplugd/mem.c
|
|
@@ -163,7 +163,7 @@ int memplug(int size)
|
|
* new value: previous value - size
|
|
*/
|
|
new_size = old_size - size;
|
|
- if (new_size <= 0)
|
|
+ if (new_size < 0)
|
|
return -1;
|
|
filp = fopen("/proc/sys/vm/cmm_pages", "w");
|
|
if (!filp) {
|
|
--
|
|
1.7.3.5
|
|
|