linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuanhua Han <hanchuanhua@fishsemi.com>
To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu
Cc: akpm@linux-foundation.org, sfr@canb.auug.org.au,
	peterx@redhat.com, shihpo.hung@sifive.com, ebiederm@xmission.com,
	schwab@suse.de, tglx@linutronix.de, Anup.Patel@wdc.com,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Chuanhua Han <hanchuanhua@fishsemi.com>
Subject: [PATCH] riscv: mm: Remove the copy operation of pmd
Date: Mon, 30 Mar 2020 19:53:19 +0800	[thread overview]
Message-ID: <20200330115319.1507-1-hanchuanhua@fishsemi.com> (raw)

Since all processes share the kernel address space,
we only need to copy pgd in case of a vmalloc page
fault exception, the other levels of page tables are
shared, so the operation of copying pmd is unnecessary.

Signed-off-by: Chuanhua Han <hanchuanhua@fishsemi.com>
---
 arch/riscv/mm/fault.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index be84e32adc4c..24f4ebfd2df8 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -208,9 +208,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
 vmalloc_fault:
 	{
 		pgd_t *pgd, *pgd_k;
-		pud_t *pud, *pud_k;
-		p4d_t *p4d, *p4d_k;
-		pmd_t *pmd, *pmd_k;
+		pud_t *pud_k;
+		p4d_t *p4d_k;
+		pmd_t *pmd_k;
 		pte_t *pte_k;
 		int index;
 
@@ -234,12 +234,10 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
 			goto no_context;
 		set_pgd(pgd, *pgd_k);
 
-		p4d = p4d_offset(pgd, addr);
 		p4d_k = p4d_offset(pgd_k, addr);
 		if (!p4d_present(*p4d_k))
 			goto no_context;
 
-		pud = pud_offset(p4d, addr);
 		pud_k = pud_offset(p4d_k, addr);
 		if (!pud_present(*pud_k))
 			goto no_context;
@@ -248,11 +246,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
 		 * Since the vmalloc area is global, it is unnecessary
 		 * to copy individual PTEs
 		 */
-		pmd = pmd_offset(pud, addr);
 		pmd_k = pmd_offset(pud_k, addr);
 		if (!pmd_present(*pmd_k))
 			goto no_context;
-		set_pmd(pmd, *pmd_k);
 
 		/*
 		 * Make sure the actual PTE exists as well to
-- 
2.17.1


             reply	other threads:[~2020-03-30 11:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 11:53 Chuanhua Han [this message]
2021-02-24 12:34 ` [PATCH] riscv: mm: Remove the copy operation of pmd Alex Ghiti
2022-01-27 10:06 hanchuanhua
2022-02-22 21:25 ` Palmer Dabbelt
2022-02-23  2:58   ` hanchuanhua

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=20200330115319.1507-1-hanchuanhua@fishsemi.com \
    --to=hanchuanhua@fishsemi.com \
    --cc=Anup.Patel@wdc.com \
    --cc=akpm@linux-foundation.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=peterx@redhat.com \
    --cc=schwab@suse.de \
    --cc=sfr@canb.auug.org.au \
    --cc=shihpo.hung@sifive.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).