public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: mm: refactor by introducing trace_page_fault_entries()
@ 2026-03-30  5:31 Austin Kim
  0 siblings, 0 replies; only message in thread
From: Austin Kim @ 2026-03-30  5:31 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Alexandre Ghiti
  Cc: linux-kernel, linux-riscv, austindh.kim, austin.kim

From: Austin Kim <austin.kim@lge.com>

Introduce trace_page_fault_entries() as an inline helper to wrap page 
faults tracepoints. This simplifies handle_page_fault() and makes the code 
cleaner and more readable. No functional change is made.

Signed-off-by: Austin Kim <austin.kim@lge.com>
---
 arch/riscv/mm/fault.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 04ed6f8ac..54c9a388c 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -271,6 +271,16 @@ static inline bool access_error(unsigned long cause, struct vm_area_struct *vma)
 	return false;
 }
 
+static __always_inline void
+trace_page_fault_entries(unsigned long address, struct pt_regs *regs,
+			 unsigned long cause_code)
+{
+	if (user_mode(regs))
+		trace_page_fault_user(address, regs, cause_code);
+	else
+		trace_page_fault_kernel(address, regs, cause_code);
+}
+
 /*
  * This routine handles page faults.  It determines the address and the
  * problem, and then passes it off to one of the appropriate routines.
@@ -294,10 +304,7 @@ void handle_page_fault(struct pt_regs *regs)
 	if (kprobe_page_fault(regs, cause))
 		return;
 
-	if (user_mode(regs))
-		trace_page_fault_user(addr, regs, cause);
-	else
-		trace_page_fault_kernel(addr, regs, cause);
+	trace_page_fault_entries(addr, regs, cause);
 
 	/*
 	 * Fault-in kernel-space virtual memory on-demand.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-30  5:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30  5:31 [PATCH] riscv: mm: refactor by introducing trace_page_fault_entries() Austin Kim

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