Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2362136ybb; Mon, 30 Mar 2020 04:55:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtC6mClop1OSPKPFRrPjwN8Cs7Z7NBpF5kGTlEFGB3uxE169z//J3xtbW5ZhlZy+YxpOOhz X-Received: by 2002:a05:6830:4013:: with SMTP id h19mr9229492ots.100.1585569301525; Mon, 30 Mar 2020 04:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585569301; cv=none; d=google.com; s=arc-20160816; b=egyDPfQP//cMIxJBjhPLuR7VMJoIxTH8JNj/s/qPbRy609vEDqeCL0H7rNYq/4mEg6 IV3mqWfZ2X2wgi73Ie3TeEg2xEYfYrcCqkDPevTPSYk0LEwiUoFhJIuxkTwP58VlVHtc 0jOC96SBtyHVOk9FsHzvf0TyoKKZSkZ2abQhFGbtbpBSgAdP7zIIhlFWRYdGD/TgLoni TthaAfBhR3mAna32EWHNpCyCwyNclFb/SvtF8zJ4w3h4SwHu0pB/0j4Vk9U9bvwG3POK p3DEIXbifiksUearjRSSRcIO/7ymwfomQcf0BO+YIkihfcWDXcDxpzamYsATl5H36ikk +W2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=murr+5eScaOINBLlkGJ37x5aq1H87BJIw/3jtmzXtzM=; b=xjjWYEYmJqLpX5Jgn9dvLOqJ4MCt1yOBoXEt16w0fjqB+zGBfj3hl9p0G+AZRO/mxR tH67AvC7zvreIdBvtwfTaNk1SWaBM/951LF5KqhQgtYgtu1FgXYF0oKwoz0xDwoiTGWJ mYZdSi83Sx7LPcBNabjSQ3uJshxA4jbG/cPVIPjg8Z1IxW1DiubBXdxxlnMOwA9BzsZ4 WOWvmg+QOTObVsz/IxdZCVYLAk7xmv3BXbgbpB+dp0QUKb/uSVGwzqAX/2CU2a6ZvCJT TMdAIdgo5v3Qbrv4zGR1a3Rs92jvfSYeNNhWHPxx6qZ30nsRmFowRJHhAtQyXbV3oVoS CUaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si4844573otk.62.2020.03.30.04.54.48; Mon, 30 Mar 2020 04:55:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730022AbgC3Lx5 (ORCPT + 99 others); Mon, 30 Mar 2020 07:53:57 -0400 Received: from out28-52.mail.aliyun.com ([115.124.28.52]:59618 "EHLO out28-52.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728764AbgC3Lx5 (ORCPT ); Mon, 30 Mar 2020 07:53:57 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.03929106|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_regular_dialog|0.0110356-0.000277475-0.988687;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03308;MF=hanchuanhua@fishsemi.com;NM=1;PH=DS;RN=14;RT=14;SR=0;TI=SMTPD_---.H7e-2Ko_1585569212; Received: from localhost.localdomain(mailfrom:hanchuanhua@fishsemi.com fp:SMTPD_---.H7e-2Ko_1585569212) by smtp.aliyun-inc.com(10.147.44.118); Mon, 30 Mar 2020 19:53:46 +0800 From: Chuanhua Han 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 Subject: [PATCH] riscv: mm: Remove the copy operation of pmd Date: Mon, 30 Mar 2020 19:53:19 +0800 Message-Id: <20200330115319.1507-1-hanchuanhua@fishsemi.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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