summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2014-07-31 09:38:07 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-08-07 17:03:47 +1000
commitdfa6297c15fffe7c1f9ed2a48de273886eb436b2 (patch)
tree529a6bd3bea094d7e319572640dc0eabcde96d71
parent3242419c0b97e9f6f4a530034fe02f674070afaf (diff)
ksm-provide-support-to-use-deferrable-timers-for-scanner-thread-fix
clean up docs, fix deferrable_timer_store() error handling Cc: Chintan Pandya <cpandya@codeaurora.org> Cc: Hugh Dickins <hughd@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--Documentation/vm/ksm.txt12
-rw-r--r--mm/ksm.c9
2 files changed, 11 insertions, 10 deletions
diff --git a/Documentation/vm/ksm.txt b/Documentation/vm/ksm.txt
index 0481235589cc..9735c87ca363 100644
--- a/Documentation/vm/ksm.txt
+++ b/Documentation/vm/ksm.txt
@@ -88,12 +88,12 @@ pages_unshared - how many pages unique but repeatedly checked for merging
pages_volatile - how many pages changing too fast to be placed in a tree
full_scans - how many times all mergeable areas have been scanned
deferrable_timer - whether to use deferrable timers or not
- e.g. "echo 1 > /sys/kernel/mm/ksm/deferrable_timer"
- Default: 0 (means, we are not using deferrable timers. Users
- might want to set deferrable_timer option if they donot want
- ksm thread to wakeup CPU to carryout ksm activities thus
- gaining on battery while compromising slightly on memory
- that could have been saved.)
+ e.g. "echo 1 > /sys/kernel/mm/ksm/deferrable_timer"
+ Default: 0 (means, we are not using deferrable timers. Users
+ might want to set deferrable_timer option if they donot want
+ ksm thread to wakeup CPU to carryout ksm activities thus
+ gaining on battery while compromising slightly on memory
+ that could have been saved.)
A high ratio of pages_sharing to pages_shared indicates good sharing, but
a high ratio of pages_unshared to pages_sharing indicates wasted effort.
diff --git a/mm/ksm.c b/mm/ksm.c
index 2c5d206dfb6d..87ae13995d6d 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2202,10 +2202,11 @@ static ssize_t deferrable_timer_store(struct kobject *kobj,
int err;
err = kstrtoul(buf, 10, &enable);
-
- if (enable == 0 || enable == 1)
- use_deferrable_timer = enable;
-
+ if (err < 0)
+ return err;
+ if (enable >= 1)
+ return -EINVAL;
+ use_deferrable_timer = enable;
return count;
}
KSM_ATTR(deferrable_timer);