Investingating why those troublesome checks that deadlocks mlocked programs are added to page fault path... at first glance they look unnecessary, so asking just in case...
Date: Tue, 25 Aug 2009 16:58:32 +0200
From: Andrea Arcangeli <email address hidden>
To: Hugh Dickins <email address hidden>
Cc: Izik Eidus <email address hidden>, Rik van Riel <email address hidden>,
Chris Wright <email address hidden>,
Nick Piggin <email address hidden>,
Andrew Morton <email address hidden>,
<email address hidden>, <email address hidden>
Subject: Re: [PATCH 9/12] ksm: fix oom deadlock
On Mon, Aug 03, 2009 at 01:18:16PM +0100, Hugh Dickins wrote:
> tables which have been freed for reuse; and even do_anonymous_page
> and __do_fault need to check they're not being called by break_ksm
> to reinstate a pte after zap_pte_range has zapped that page table.
This deadlocks exit_mmap in an infinite loop when there's some region
locked. mlock calls gup and pretends to page fault successfully if
there's a vma existing on the region, but it doesn't page fault
anymore because of the mm_count being 0 already, so follow_page fails
and gup retries the page fault forever. And generally I don't like to
add those checks to page fault fast path.
Given we check mm_users == 0 (ksm_test_exit) after taking mmap_sem in
unmerge_and_remove_all_rmap_items, why do we actually need to care
that a page fault happens? We hold mmap_sem so we're guaranteed to see
mm_users == 0 and we won't ever break COW on that mm with mm_users ==
0 so I think those troublesome checks from page fault can be simply
removed.
Investingating why those troublesome checks that deadlocks mlocked programs are added to page fault path... at first glance they look unnecessary, so asking just in case...
Date: Tue, 25 Aug 2009 16:58:32 +0200
From: Andrea Arcangeli <email address hidden>
To: Hugh Dickins <email address hidden>
Cc: Izik Eidus <email address hidden>, Rik van Riel <email address hidden>,
Chris Wright <email address hidden>,
Nick Piggin <email address hidden>,
Andrew Morton <email address hidden>,
<email address hidden>, <email address hidden>
Subject: Re: [PATCH 9/12] ksm: fix oom deadlock
On Mon, Aug 03, 2009 at 01:18:16PM +0100, Hugh Dickins wrote:
> tables which have been freed for reuse; and even do_anonymous_page
> and __do_fault need to check they're not being called by break_ksm
> to reinstate a pte after zap_pte_range has zapped that page table.
This deadlocks exit_mmap in an infinite loop when there's some region
locked. mlock calls gup and pretends to page fault successfully if
there's a vma existing on the region, but it doesn't page fault
anymore because of the mm_count being 0 already, so follow_page fails
and gup retries the page fault forever. And generally I don't like to
add those checks to page fault fast path.
Given we check mm_users == 0 (ksm_test_exit) after taking mmap_sem in and_remove_ all_rmap_ items, why do we actually need to care
unmerge_
that a page fault happens? We hold mmap_sem so we're guaranteed to see
mm_users == 0 and we won't ever break COW on that mm with mm_users ==
0 so I think those troublesome checks from page fault can be simply
removed.