linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/thp: Rename pmd_to_page() as pmd_pgtable_page()
@ 2022-11-24 13:16 Anshuman Khandual
  2022-11-24 21:46 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Anshuman Khandual @ 2022-11-24 13:16 UTC (permalink / raw)
  To: linux-mm; +Cc: Anshuman Khandual, Andrew Morton, linux-kernel

Current pmd_to_page(), which derives the page table page containing the pmd
address has a very misleading name. The problem being, it sounds similar to
pmd_page() which derives page embedded in a given pmd entry either for next
level page or a mapped huge page. Rename it as pmd_pgtable_page() instead.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.1-rc6

 include/linux/mm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8bbcccbc5565..e9e387caffac 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2403,7 +2403,7 @@ static inline void pgtable_pte_page_dtor(struct page *page)
 
 #if USE_SPLIT_PMD_PTLOCKS
 
-static struct page *pmd_to_page(pmd_t *pmd)
+static struct page *pmd_pgtable_page(pmd_t *pmd)
 {
 	unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1);
 	return virt_to_page((void *)((unsigned long) pmd & mask));
@@ -2411,7 +2411,7 @@ static struct page *pmd_to_page(pmd_t *pmd)
 
 static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
 {
-	return ptlock_ptr(pmd_to_page(pmd));
+	return ptlock_ptr(pmd_pgtable_page(pmd));
 }
 
 static inline bool pmd_ptlock_init(struct page *page)
@@ -2430,7 +2430,7 @@ static inline void pmd_ptlock_free(struct page *page)
 	ptlock_free(page);
 }
 
-#define pmd_huge_pte(mm, pmd) (pmd_to_page(pmd)->pmd_huge_pte)
+#define pmd_huge_pte(mm, pmd) (pmd_pgtable_page(pmd)->pmd_huge_pte)
 
 #else
 
-- 
2.25.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/thp: Rename pmd_to_page() as pmd_pgtable_page()
  2022-11-24 13:16 [PATCH] mm/thp: Rename pmd_to_page() as pmd_pgtable_page() Anshuman Khandual
@ 2022-11-24 21:46 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2022-11-24 21:46 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, linux-kernel

On Thu, 24 Nov 2022 18:46:41 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:

> Current pmd_to_page(), which derives the page table page containing the pmd
> address has a very misleading name. The problem being, it sounds similar to
> pmd_page() which derives page embedded in a given pmd entry either for next
> level page or a mapped huge page. Rename it as pmd_pgtable_page() instead.
> 

Is the new name much clearer?

There are a zillion of these little conversion functions in the pagemap
layer, all quite confusing yet we seem to have decided that they are so
plainly obvious that no code commenting is needed.  Sigh.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-24 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 13:16 [PATCH] mm/thp: Rename pmd_to_page() as pmd_pgtable_page() Anshuman Khandual
2022-11-24 21:46 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox