Re: [GIT PULL] Please pull hwpoison updates for 2.6.37

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 27, 2010 at 11:09:03AM +0200, Ingo Molnar wrote:
> 
> * Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> 
> > > You are welcome! How about the cleanliness feedback that i gave?
> > > (the stuff in parentheses)
> > 
> > Could move the ifdef into mm.h for the flags and let the optimizer
> > eliminate the code. I can do that in a followup patch.
> 
> Yeah. If it does not work out due to architectural differences then
> do not push it too hard (the code is small enough) - we only want to
> factor this out if it makes things cleaner.

Here's the patch I came up with. I'll keep it in my tree for now.

-Andi

---

x86/HWPOISON: Move do_sigbus ifdef into header
    
Ingo asked for moving the MEMORY_FAILURE ifdef in the x86's
fault handler's do_sigbus elsewhere. This patch moves the
ifdef into mm.h by defining the HWPOISON return flags
of handle_mm_fault() to 0 if MEMORY_FAILURE is not enabled.
This way the optimizer can eliminate the code without ifdef.
    
Reported-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 852b319..8b76d79 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -812,14 +812,12 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
 	tsk->thread.error_code	= error_code;
 	tsk->thread.trap_no	= 14;
 
-#ifdef CONFIG_MEMORY_FAILURE
 	if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
 		printk(KERN_ERR
 	"MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",
 			tsk->comm, tsk->pid, address);
 		code = BUS_MCEERR_AR;
 	}
-#endif
 	force_sig_info_fault(SIGBUS, code, address, tsk, fault);
 }
 
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a4c6684..d9a6af5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -718,8 +718,13 @@ static inline int page_mapped(struct page *page)
 #define VM_FAULT_SIGBUS	0x0002
 #define VM_FAULT_MAJOR	0x0004
 #define VM_FAULT_WRITE	0x0008	/* Special case for get_user_pages */
+#ifdef CONFIG_MEMORY_FAILURE
 #define VM_FAULT_HWPOISON 0x0010	/* Hit poisoned small page */
 #define VM_FAULT_HWPOISON_LARGE 0x0020  /* Hit poisoned large page. Index encoded in upper bits */
+#else
+#define VM_FAULT_HWPOISON 0
+#define VM_FAULT_HWPOISON_LARGE 0
+#endif
 
 #define VM_FAULT_NOPAGE	0x0100	/* ->fault installed the pte, not return page */
 #define VM_FAULT_LOCKED	0x0200	/* ->fault locked the returned page */


-- 
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]