From: Austin Kim <austindh.kim@gmail.com>
To: Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alexandre Ghiti <alex@ghiti.fr>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
austindh.kim@gmail.com, austin.kim@lge.com
Subject: [PATCH] riscv: mm: refactor by introducing trace_page_fault_entries()
Date: Mon, 30 Mar 2026 14:31:37 +0900 [thread overview]
Message-ID: <acoKudXTM2AjQjKB@adminpc-PowerEdge-R7525> (raw)
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
reply other threads:[~2026-03-30 5:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acoKudXTM2AjQjKB@adminpc-PowerEdge-R7525 \
--to=austindh.kim@gmail.com \
--cc=alex@ghiti.fr \
--cc=austin.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox