mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-perf-users@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/events: replace READ_ONCE() with standard page table accessors
Date: Mon, 6 Oct 2025 10:22:38 +0200	[thread overview]
Message-ID: <20251006082238.GQ3245006@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20251006042622.1743675-1-anshuman.khandual@arm.com>

On Mon, Oct 06, 2025 at 05:26:22AM +0100, Anshuman Khandual wrote:
> Replace READ_ONCE() with standard page table accessors i.e pxdp_get() which
> anyways default into READ_ONCE() in cases where platform does not override.

Note that these accessors are more recent than the code in question.

Furthermore, I can only find two pointless overrides and suggest the
below.

This then raises the question of the purpose of these accessors; why
isn't a plain READ_ONCE() preferred if that is really all it is?

[ this skips over the ptep_get() issue, which does seem a little more
involved -- but also has some definite want of cleanups ]

---
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 86378eec7757..c4c23dc4dc77 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -150,8 +150,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
 
 extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
 
-#define pgdp_get(pgpd)		READ_ONCE(*pgdp)
-
 #define pud_page(pud)		pmd_page(__pmd(pud_val(pud)))
 #define pud_write(pud)		pmd_write(__pmd(pud_val(pud)))
 
diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
index bd128696e96d..8184e8c44db6 100644
--- a/arch/loongarch/include/asm/pgtable.h
+++ b/arch/loongarch/include/asm/pgtable.h
@@ -107,7 +107,6 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
 #define KFENCE_AREA_END		(KFENCE_AREA_START + KFENCE_AREA_SIZE - 1)
 
 #define ptep_get(ptep) READ_ONCE(*(ptep))
-#define pmdp_get(pmdp) READ_ONCE(*(pmdp))
 
 #define pte_ERROR(e) \
 	pr_err("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 25a7257052ff..bc76db9974e4 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -341,33 +341,25 @@ static inline pte_t ptep_get(pte_t *ptep)
 }
 #endif
 
-#ifndef pmdp_get
 static inline pmd_t pmdp_get(pmd_t *pmdp)
 {
 	return READ_ONCE(*pmdp);
 }
-#endif
 
-#ifndef pudp_get
 static inline pud_t pudp_get(pud_t *pudp)
 {
 	return READ_ONCE(*pudp);
 }
-#endif
 
-#ifndef p4dp_get
 static inline p4d_t p4dp_get(p4d_t *p4dp)
 {
 	return READ_ONCE(*p4dp);
 }
-#endif
 
-#ifndef pgdp_get
 static inline pgd_t pgdp_get(pgd_t *pgdp)
 {
 	return READ_ONCE(*pgdp);
 }
-#endif
 
 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
 static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,

  reply	other threads:[~2025-10-06  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06  4:26 Anshuman Khandual
2025-10-06  8:22 ` Peter Zijlstra [this message]
2025-10-06  8:40   ` Anshuman Khandual
2025-10-06  8:48     ` Peter Zijlstra

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=20251006082238.GQ3245006@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@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

all inboxes | Powered by JetHome®