diff options
author | Jason Liu <r64343@freescale.com> | 2013-01-11 17:31:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-11 17:54:54 -0500 |
commit | 7964c06d66c76507d8b6b662bffea770c29ef0ce (patch) | |
tree | f723b15a16d13a17b252df12579fe9956d554a4a | |
parent | c0232ae861df679092c15960b6cd9f589d9b7177 (diff) |
mm: compaction: fix echo 1 > compact_memory return error issue
when run the folloing command under shell, it will return error
sh/$ echo 1 > /proc/sys/vm/compact_memory
sh/$ sh: write error: Bad address
After strace, I found the following log:
...
write(1, "1\n", 2) = 3
write(1, "", 4294967295) = -1 EFAULT (Bad address)
write(2, "echo: write error: Bad address\n", 31echo: write error: Bad address
) = 31
This tells system return 3(COMPACT_COMPLETE) after write data to
compact_memory.
The fix is to make the system just return 0 instead 3(COMPACT_COMPLETE)
from sysctl_compaction_handler after compaction_nodes finished.
Signed-off-by: Jason Liu <r64343@freescale.com>
Suggested-by: David Rientjes <rientjes@google.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/compaction.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 6b807e466497..f8f5c111b7d7 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -1210,7 +1210,7 @@ static int compact_node(int nid) | |||
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | /* Compact all nodes in the system */ | 1212 | /* Compact all nodes in the system */ |
1213 | static int compact_nodes(void) | 1213 | static void compact_nodes(void) |
1214 | { | 1214 | { |
1215 | int nid; | 1215 | int nid; |
1216 | 1216 | ||
@@ -1219,8 +1219,6 @@ static int compact_nodes(void) | |||
1219 | 1219 | ||
1220 | for_each_online_node(nid) | 1220 | for_each_online_node(nid) |
1221 | compact_node(nid); | 1221 | compact_node(nid); |
1222 | |||
1223 | return COMPACT_COMPLETE; | ||
1224 | } | 1222 | } |
1225 | 1223 | ||
1226 | /* The written value is actually unused, all memory is compacted */ | 1224 | /* The written value is actually unused, all memory is compacted */ |
@@ -1231,7 +1229,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write, | |||
1231 | void __user *buffer, size_t *length, loff_t *ppos) | 1229 | void __user *buffer, size_t *length, loff_t *ppos) |
1232 | { | 1230 | { |
1233 | if (write) | 1231 | if (write) |
1234 | return compact_nodes(); | 1232 | compact_nodes(); |
1235 | 1233 | ||
1236 | return 0; | 1234 | return 0; |
1237 | } | 1235 | } |