Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754177AbZKJWGq (ORCPT ); Tue, 10 Nov 2009 17:06:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752016AbZKJWGp (ORCPT ); Tue, 10 Nov 2009 17:06:45 -0500 Received: from mk-filter-2-a-1.mail.uk.tiscali.com ([212.74.100.53]:56923 "EHLO mk-filter-2-a-1.mail.uk.tiscali.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751698AbZKJWGo (ORCPT ); Tue, 10 Nov 2009 17:06:44 -0500 X-Trace: 287471638/mk-filter-2.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/79.69.44.180/None/hugh.dickins@tiscali.co.uk X-SBRS: None X-RemoteIP: 79.69.44.180 X-IP-MAIL-FROM: hugh.dickins@tiscali.co.uk X-SMTP-AUTH: X-MUA: X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkFANZy+UpPRSy0/2dsb2JhbACBTt0ohD4E X-IronPort-AV: E=Sophos;i="4.44,718,1249254000"; d="scan'208";a="287471638" Date: Tue, 10 Nov 2009 22:06:49 +0000 (GMT) From: Hugh Dickins X-X-Sender: hugh@sister.anvils To: Andrew Morton cc: Izik Eidus , Andrea Arcangeli , KAMEZAWA Hiroyuki , Minchan Kim , Andi Kleen , Wu Fengguang , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 6/6] mm: sigbus instead of abusing oom In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1872 Lines: 49 When do_nonlinear_fault() realizes that the page table must have been corrupted for it to have been called, it does print_bad_pte() and returns ... VM_FAULT_OOM, which is hard to understand. It made some sense when I did it for 2.6.15, when do_page_fault() just killed the current process; but nowadays it lets the OOM killer decide who to kill - so page table corruption in one process would be liable to kill another. Change it to return VM_FAULT_SIGBUS instead: that doesn't guarantee that the process will be killed, but is good enough for such a rare abnormality, accompanied as it is by the "BUG: Bad page map" message. And recent HWPOISON work has copied that code into do_swap_page(), when it finds an impossible swap entry: fix that to VM_FAULT_SIGBUS too. Signed-off-by: Hugh Dickins --- This one has nothing whatever to do with KSM swapping, just something that KAMEZAWA-san and Minchan noticed recently. mm/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- mm5/mm/memory.c 2009-11-02 12:32:34.000000000 +0000 +++ mm6/mm/memory.c 2009-11-07 14:44:58.000000000 +0000 @@ -2529,7 +2529,7 @@ static int do_swap_page(struct mm_struct ret = VM_FAULT_HWPOISON; } else { print_bad_pte(vma, address, orig_pte, NULL); - ret = VM_FAULT_OOM; + ret = VM_FAULT_SIGBUS; } goto out; } @@ -2925,7 +2925,7 @@ static int do_nonlinear_fault(struct mm_ * Page table corrupted: show pte and kill process. */ print_bad_pte(vma, address, orig_pte, NULL); - return VM_FAULT_OOM; + return VM_FAULT_SIGBUS; } pgoff = pte_to_pgoff(orig_pte); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/