public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: simplify notify_page_fault()
@ 2007-01-08 13:31 Jan Beulich
  2007-06-23  8:04 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2007-01-08 13:31 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, patches

Remove all parameters from this function that aren't really variable.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- linux-2.6.20-rc4/arch/i386/mm/fault.c	2007-01-08 09:57:20.000000000 +0100
+++ 2.6.20-rc4-x86-simplify-notify_page_fault/arch/i386/mm/fault.c	2007-01-08 10:32:45.000000000 +0100
@@ -46,17 +46,17 @@ int unregister_page_fault_notifier(struc
 }
 EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
 
-static inline int notify_page_fault(enum die_val val, const char *str,
-			struct pt_regs *regs, long err, int trap, int sig)
+static inline int notify_page_fault(struct pt_regs *regs, long err)
 {
 	struct die_args args = {
 		.regs = regs,
-		.str = str,
+		.str = "page fault",
 		.err = err,
-		.trapnr = trap,
-		.signr = sig
+		.trapnr = 14,
+		.signr = SIGSEGV
 	};
-	return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
+	return atomic_notifier_call_chain(&notify_page_fault_chain,
+	                                  DIE_PAGE_FAULT, &args);
 }
 
 /*
@@ -353,8 +353,7 @@ fastcall void __kprobes do_page_fault(st
 	if (unlikely(address >= TASK_SIZE)) {
 		if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
 			return;
-		if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
-						SIGSEGV) == NOTIFY_STOP)
+		if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
 			return;
 		/*
 		 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -363,8 +362,7 @@ fastcall void __kprobes do_page_fault(st
 		goto bad_area_nosemaphore;
 	}
 
-	if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
-					SIGSEGV) == NOTIFY_STOP)
+	if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
 		return;
 
 	/* It's safe to allow irq's after cr2 has been saved and the vmalloc
--- linux-2.6.20-rc4/arch/x86_64/mm/fault.c	2007-01-08 09:57:27.000000000 +0100
+++ 2.6.20-rc4-x86-simplify-notify_page_fault/arch/x86_64/mm/fault.c	2007-01-08 10:33:11.000000000 +0100
@@ -56,17 +56,17 @@ int unregister_page_fault_notifier(struc
 }
 EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
 
-static inline int notify_page_fault(enum die_val val, const char *str,
-			struct pt_regs *regs, long err, int trap, int sig)
+static inline int notify_page_fault(struct pt_regs *regs, long err)
 {
 	struct die_args args = {
 		.regs = regs,
-		.str = str,
+		.str = "page fault",
 		.err = err,
-		.trapnr = trap,
-		.signr = sig
+		.trapnr = 14,
+		.signr = SIGSEGV
 	};
-	return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
+	return atomic_notifier_call_chain(&notify_page_fault_chain,
+	                                  DIE_PAGE_FAULT, &args);
 }
 
 void bust_spinlocks(int yes)
@@ -376,8 +376,7 @@ asmlinkage void __kprobes do_page_fault(
 			if (vmalloc_fault(address) >= 0)
 				return;
 		}
-		if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
-						SIGSEGV) == NOTIFY_STOP)
+		if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
 			return;
 		/*
 		 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -386,8 +385,7 @@ asmlinkage void __kprobes do_page_fault(
 		goto bad_area_nosemaphore;
 	}
 
-	if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
-					SIGSEGV) == NOTIFY_STOP)
+	if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
 		return;
 
 	if (likely(regs->eflags & X86_EFLAGS_IF))



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: simplify notify_page_fault()
  2007-01-08 13:31 [PATCH] x86: simplify notify_page_fault() Jan Beulich
@ 2007-06-23  8:04 ` Christoph Hellwig
  2007-06-23  9:30   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2007-06-23  8:04 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andi Kleen, linux-kernel, patches

On Mon, Jan 08, 2007 at 01:31:11PM +0000, Jan Beulich wrote:
> Remove all parameters from this function that aren't really variable.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> --- linux-2.6.20-rc4/arch/i386/mm/fault.c	2007-01-08 09:57:20.000000000 +0100
> +++ 2.6.20-rc4-x86-simplify-notify_page_fault/arch/i386/mm/fault.c	2007-01-08 10:32:45.000000000 +0100
> @@ -46,17 +46,17 @@ int unregister_page_fault_notifier(struc
>  }
>  EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
>  
> -static inline int notify_page_fault(enum die_val val, const char *str,
> -			struct pt_regs *regs, long err, int trap, int sig)
> +static inline int notify_page_fault(struct pt_regs *regs, long err)
>  {
>  	struct die_args args = {
>  		.regs = regs,
> -		.str = str,
> +		.str = "page fault",
>  		.err = err,
> -		.trapnr = trap,
> -		.signr = sig
> +		.trapnr = 14,
> +		.signr = SIGSEGV
>  	};
> -	return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
> +	return atomic_notifier_call_chain(&notify_page_fault_chain,
> +	                                  DIE_PAGE_FAULT, &args);
>  }

Btw, WTF

>  
>  /*
> @@ -353,8 +353,7 @@ fastcall void __kprobes do_page_fault(st
>  	if (unlikely(address >= TASK_SIZE)) {
>  		if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
>  			return;
> -		if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
> -						SIGSEGV) == NOTIFY_STOP)
> +		if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
>  			return;
>  		/*
>  		 * Don't take the mm semaphore here. If we fixup a prefetch
> @@ -363,8 +362,7 @@ fastcall void __kprobes do_page_fault(st
>  		goto bad_area_nosemaphore;
>  	}
>  
> -	if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
> -					SIGSEGV) == NOTIFY_STOP)
> +	if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
>  		return;
>  
>  	/* It's safe to allow irq's after cr2 has been saved and the vmalloc
> --- linux-2.6.20-rc4/arch/x86_64/mm/fault.c	2007-01-08 09:57:27.000000000 +0100
> +++ 2.6.20-rc4-x86-simplify-notify_page_fault/arch/x86_64/mm/fault.c	2007-01-08 10:33:11.000000000 +0100
> @@ -56,17 +56,17 @@ int unregister_page_fault_notifier(struc
>  }
>  EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
>  
> -static inline int notify_page_fault(enum die_val val, const char *str,
> -			struct pt_regs *regs, long err, int trap, int sig)
> +static inline int notify_page_fault(struct pt_regs *regs, long err)
>  {
>  	struct die_args args = {
>  		.regs = regs,
> -		.str = str,
> +		.str = "page fault",
>  		.err = err,
> -		.trapnr = trap,
> -		.signr = sig
> +		.trapnr = 14,
> +		.signr = SIGSEGV
>  	};
> -	return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
> +	return atomic_notifier_call_chain(&notify_page_fault_chain,
> +	                                  DIE_PAGE_FAULT, &args);
>  }
>  
>  void bust_spinlocks(int yes)
> @@ -376,8 +376,7 @@ asmlinkage void __kprobes do_page_fault(
>  			if (vmalloc_fault(address) >= 0)
>  				return;
>  		}
> -		if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
> -						SIGSEGV) == NOTIFY_STOP)
> +		if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
>  			return;
>  		/*
>  		 * Don't take the mm semaphore here. If we fixup a prefetch
> @@ -386,8 +385,7 @@ asmlinkage void __kprobes do_page_fault(
>  		goto bad_area_nosemaphore;
>  	}
>  
> -	if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
> -					SIGSEGV) == NOTIFY_STOP)
> +	if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
>  		return;
>  
>  	if (likely(regs->eflags & X86_EFLAGS_IF))
> 
> 
> -
> 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/
---end quoted text---

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: simplify notify_page_fault()
  2007-06-23  8:04 ` Christoph Hellwig
@ 2007-06-23  9:30   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2007-06-23  9:30 UTC (permalink / raw)
  To: Christoph Hellwig, Jan Beulich, Andi Kleen, linux-kernel, patches

sorry, this mail leaked out when trying to clean up my to reply queue.
Ignore it, all the issue have been resolved in the meantime.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-23  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 13:31 [PATCH] x86: simplify notify_page_fault() Jan Beulich
2007-06-23  8:04 ` Christoph Hellwig
2007-06-23  9:30   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox