linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wupeng Ma <mawupeng1@huawei.com>
To: <akpm@linux-foundation.org>, <dave.hansen@linux.intel.com>,
	<luto@kernel.org>, <tglx@linutronix.de>, <peterz@infradead.org>,
	<hpa@zytor.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	<mawupeng1@huawei.com>, <bp@suse.de>, <mingo@redhat.com>,
	<rdunlap@infradead.org>, <bhelgaas@google.com>,
	<linux-mm@kvack.org>
Subject: [PATCH v4 2/3] x86/mm/pat: Cleanup unused parameter in follow_phys
Date: Tue, 20 Feb 2024 11:48:34 +0800	[thread overview]
Message-ID: <20240220034835.507022-3-mawupeng1@huawei.com> (raw)
In-Reply-To: <20240220034835.507022-1-mawupeng1@huawei.com>

From: Ma Wupeng <mawupeng1@huawei.com>

Parameter flags is always zero in caller untrack_pfn() and
track_pfn_copy(). let's drop it.

Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
 arch/x86/mm/pat/memtype.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index d8c37aaaf041..5b56f08f8ce6 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -950,8 +950,7 @@ static void free_pfn_range(u64 paddr, unsigned long size)
 		memtype_free(paddr, paddr + size);
 }
 
-static int follow_phys(struct vm_area_struct *vma,
-		unsigned long address, unsigned int flags,
+static int follow_phys(struct vm_area_struct *vma, unsigned long address,
 		unsigned long *prot, resource_size_t *phys)
 {
 	int ret = -EINVAL;
@@ -965,14 +964,10 @@ static int follow_phys(struct vm_area_struct *vma,
 		goto out;
 	pte = ptep_get(ptep);
 
-	if ((flags & FOLL_WRITE) && !pte_write(pte))
-		goto unlock;
-
 	*prot = pgprot_val(pte_pgprot(pte));
 	*phys = (resource_size_t)pte_pfn(pte) << PAGE_SHIFT;
 
 	ret = 0;
-unlock:
 	pte_unmap_unlock(ptep, ptl);
 out:
 	return ret;
@@ -997,7 +992,7 @@ int track_pfn_copy(struct vm_area_struct *vma)
 		 * reserve the whole chunk covered by vma. We need the
 		 * starting address and protection from pte.
 		 */
-		if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) {
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
 			WARN_ON_ONCE(1);
 			return -EINVAL;
 		}
@@ -1084,7 +1079,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
 	/* free the chunk starting from pfn or the whole chunk */
 	paddr = (resource_size_t)pfn << PAGE_SHIFT;
 	if (!paddr && !size) {
-		if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) {
+		if (follow_phys(vma, vma->vm_start, &prot, &paddr)) {
 			WARN_ON_ONCE(1);
 			return;
 		}
-- 
2.25.1



  parent reply	other threads:[~2024-02-20  3:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20  3:48 [PATCH v4 0/3] Cleanup for PAT Wupeng Ma
2024-02-20  3:48 ` [PATCH v4 1/3] x86/mm/pat: Move follow_phys to pat-related file Wupeng Ma
2024-02-20  3:48 ` Wupeng Ma [this message]
2024-02-20  3:48 ` [PATCH v4 3/3] x86/mm/pat: Remove WARN_ON_ONCE if follow_phys fails Wupeng Ma
2024-02-20  8:37 ` [PATCH v4 0/3] Cleanup for PAT Xin Li
2024-02-20  9:06   ` mawupeng
2024-02-20 18:46     ` Xin Li

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=20240220034835.507022-3-mawupeng1@huawei.com \
    --to=mawupeng1@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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