Hugh Dickins d952b79136 ksm: fix endless loop on oom
break_ksm has been looping endlessly ignoring VM_FAULT_OOM: that should
only be a problem for ksmd when a memory control group imposes limits
(normally the OOM killer will kill others with an mm until it succeeds);
but in general (especially for MADV_UNMERGEABLE and KSM_RUN_UNMERGE) we
do need to route the error (or kill) back to the caller (or sighandling).

Test signal_pending in unmerge_ksm_pages, which could be a lengthy
procedure if it has to spill into swap: returning -ERESTARTSYS so that
trivial signals will restart but fatals will terminate (is that right?
we do different things in different places in mm, none exactly this).

unmerge_and_remove_all_rmap_items was forgetting to lock when going
down the mm_list: fix that.  Whether it's successful or not, reset
ksm_scan cursor to head; but only if it's successful, reset seqnr
(shown in full_scans) - page counts will have gone down to zero.

This patch leaves a significant OOM deadlock, but it's a good step
on the way, and that deadlock is fixed in a subsequent patch.

Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Acked-by: Izik Eidus <ieidus@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-22 07:17:32 -07:00
..
2009-04-01 08:59:13 -07:00
2009-09-22 07:17:27 -07:00
2009-06-16 19:47:28 -07:00
2009-09-22 07:17:31 -07:00
2009-09-22 07:17:32 -07:00
2009-09-22 07:17:31 -07:00
2009-09-22 07:17:31 -07:00
2009-09-22 07:17:31 -07:00
2009-08-10 08:31:16 -07:00
2009-09-22 07:17:29 -07:00
2009-09-22 07:17:31 -07:00
2008-06-12 18:05:41 -07:00
2007-10-20 01:27:18 +02:00
2009-09-22 07:17:31 -07:00
2009-06-29 09:57:10 +03:00
2009-06-23 12:50:05 -07:00
2009-09-22 07:17:30 -07:00
2009-09-22 07:17:30 -07:00
2009-09-22 07:17:29 -07:00