diff options
author | Andi Kleen <andi@firstfloor.org> | 2009-09-16 05:50:15 -0400 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2009-09-16 05:50:15 -0400 |
commit | 6a46079cf57a7f7758e8b926980a4f852f89b34d (patch) | |
tree | efd72e830201370d6273bd436dda5a3c4cd6ed9b /Documentation/sysctl | |
parent | 4db96cf077aa938b11fe7ac79ecc9b29ec00fbab (diff) |
HWPOISON: The high level memory error handler in the VM v7
Add the high level memory handler that poisons pages
that got corrupted by hardware (typically by a two bit flip in a DIMM
or a cache) on the Linux level. The goal is to prevent everyone
from accessing these pages in the future.
This done at the VM level by marking a page hwpoisoned
and doing the appropriate action based on the type of page
it is.
The code that does this is portable and lives in mm/memory-failure.c
To quote the overview comment:
High level machine check handler. Handles pages reported by the
hardware as being corrupted usually due to a 2bit ECC memory or cache
failure.
This focuses on pages detected as corrupted in the background.
When the current CPU tries to consume corruption the currently
running process can just be killed directly instead. This implies
that if the error cannot be handled for some reason it's safe to
just ignore it because no corruption has been consumed yet. Instead
when that happens another machine check will happen.
Handles page cache pages in various states. The tricky part
here is that we can access any page asynchronous to other VM
users, because memory failures could happen anytime and anywhere,
possibly violating some of their assumptions. This is why this code
has to be extremely careful. Generally it tries to use normal locking
rules, as in get the standard locks, even if that means the
error handling takes potentially a long time.
Some of the operations here are somewhat inefficient and have non
linear algorithmic complexity, because the data structures have not
been optimized for this case. This is in particular the case
for the mapping from a vma to a process. Since this case is expected
to be rare we hope we can get away with this.
There are in principle two strategies to kill processes on poison:
- just unmap the data and wait for an actual reference before
killing
- kill as soon as corruption is detected.
Both have advantages and disadvantages and should be used
in different situations. Right now both are implemented and can
be switched with a new sysctl vm.memory_failure_early_kill
The default is early kill.
The patch does some rmap data structure walking on its own to collect
processes to kill. This is unusual because normally all rmap data structure
knowledge is in rmap.c only. I put it here for now to keep
everything together and rmap knowledge has been seeping out anyways
Includes contributions from Johannes Weiner, Chris Mason, Fengguang Wu,
Nick Piggin (who did a lot of great work) and others.
Cc: npiggin@suse.de
Cc: riel@redhat.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Diffstat (limited to 'Documentation/sysctl')
-rw-r--r-- | Documentation/sysctl/vm.txt | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index c4de6359d440..faf62740aa2c 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -32,6 +32,8 @@ Currently, these files are in /proc/sys/vm: | |||
32 | - legacy_va_layout | 32 | - legacy_va_layout |
33 | - lowmem_reserve_ratio | 33 | - lowmem_reserve_ratio |
34 | - max_map_count | 34 | - max_map_count |
35 | - memory_failure_early_kill | ||
36 | - memory_failure_recovery | ||
35 | - min_free_kbytes | 37 | - min_free_kbytes |
36 | - min_slab_ratio | 38 | - min_slab_ratio |
37 | - min_unmapped_ratio | 39 | - min_unmapped_ratio |
@@ -53,7 +55,6 @@ Currently, these files are in /proc/sys/vm: | |||
53 | - vfs_cache_pressure | 55 | - vfs_cache_pressure |
54 | - zone_reclaim_mode | 56 | - zone_reclaim_mode |
55 | 57 | ||
56 | |||
57 | ============================================================== | 58 | ============================================================== |
58 | 59 | ||
59 | block_dump | 60 | block_dump |
@@ -275,6 +276,44 @@ e.g., up to one or two maps per allocation. | |||
275 | 276 | ||
276 | The default value is 65536. | 277 | The default value is 65536. |
277 | 278 | ||
279 | ============================================================= | ||
280 | |||
281 | memory_failure_early_kill: | ||
282 | |||
283 | Control how to kill processes when uncorrected memory error (typically | ||
284 | a 2bit error in a memory module) is detected in the background by hardware | ||
285 | that cannot be handled by the kernel. In some cases (like the page | ||
286 | still having a valid copy on disk) the kernel will handle the failure | ||
287 | transparently without affecting any applications. But if there is | ||
288 | no other uptodate copy of the data it will kill to prevent any data | ||
289 | corruptions from propagating. | ||
290 | |||
291 | 1: Kill all processes that have the corrupted and not reloadable page mapped | ||
292 | as soon as the corruption is detected. Note this is not supported | ||
293 | for a few types of pages, like kernel internally allocated data or | ||
294 | the swap cache, but works for the majority of user pages. | ||
295 | |||
296 | 0: Only unmap the corrupted page from all processes and only kill a process | ||
297 | who tries to access it. | ||
298 | |||
299 | The kill is done using a catchable SIGBUS with BUS_MCEERR_AO, so processes can | ||
300 | handle this if they want to. | ||
301 | |||
302 | This is only active on architectures/platforms with advanced machine | ||
303 | check handling and depends on the hardware capabilities. | ||
304 | |||
305 | Applications can override this setting individually with the PR_MCE_KILL prctl | ||
306 | |||
307 | ============================================================== | ||
308 | |||
309 | memory_failure_recovery | ||
310 | |||
311 | Enable memory failure recovery (when supported by the platform) | ||
312 | |||
313 | 1: Attempt recovery. | ||
314 | |||
315 | 0: Always panic on a memory failure. | ||
316 | |||
278 | ============================================================== | 317 | ============================================================== |
279 | 318 | ||
280 | min_free_kbytes: | 319 | min_free_kbytes: |