Skip to contentSkip to conversation

parisc: fix PMD pages allocation by restoring pmd_alloc_one()

PATCH In review Mike Rapoport 4 participants 6 messages Aug 16, 2020 – Aug 17, 2020 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parisc: fix PMD pages allocation by restoring pmd_alloc_one()

From: Mike Rapoport <[email protected]>

Commit 1355c31eeb7e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()") converted parisc to use generic version of pmd_alloc_one() but it missed the fact that parisc uses order-1 pages for PMD.

Restore the original version of pmd_alloc_one() for parisc, just use GFP_PGTABLE_KERNEL that implies __GFP_ZERO instead of GFP_KERNEL and memset.

Fixes 1355c31eeb7e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()")

---

Hi,

I've trimmed the 'cc list relatively to the bug report and added parisc maintainers.

 arch/parisc/include/asm/pgalloc.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/parisc/include/asm/pgalloc.h +6 -0
index cc7ecc2ef55d..a6482b2ce0ea 100644
@@ -10,6 +10,7 @@
 
 #include <asm/cache.h>
 
+#define __HAVE_ARCH_PMD_ALLOC_ONE
 #define __HAVE_ARCH_PMD_FREE
 #define __HAVE_ARCH_PGD_FREE
 #include <asm-generic/pgalloc.h>
@@ -67,6 +68,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 			(__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT)));
 }
 
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+	return (pmd_t *)__get_free_pages(GFP_PGTABLE_KERNEL, PMD_ORDER);
+}
+
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 	if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mike Rapoport

From: Mike Rapoport <[email protected]>

Commit 1355c31eeb7e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()") converted parisc to use generic version of pmd_alloc_one() but it missed the fact that parisc uses order-1 pages for PMD.

Quoted 6 lines

Restore the original version of pmd_alloc_one() for parisc, just use GFP_PGTABLE_KERNEL that implies __GFP_ZERO instead of GFP_KERNEL and memset.

Fixes 1355c31eeb7e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()")

typo, "Reported-by"

Quoted 40 lines

---

Hi,

I've trimmed the 'cc list relatively to the bug report and added parisc maintainers.

 arch/parisc/include/asm/pgalloc.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/parisc/include/asm/pgalloc.h +6 -0
index cc7ecc2ef55d..a6482b2ce0ea 100644
@@ -10,6 +10,7 @@
 
 #include <asm/cache.h>
 
+#define __HAVE_ARCH_PMD_ALLOC_ONE
 #define __HAVE_ARCH_PMD_FREE
 #define __HAVE_ARCH_PGD_FREE
 #include <asm-generic/pgalloc.h>
@@ -67,6 +68,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 			(__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT)));
 }
 
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+	return (pmd_t *)__get_free_pages(GFP_PGTABLE_KERNEL, PMD_ORDER);
+}
+
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 	if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
Signature · 1 line
2.26.2
#2 lore raw
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Mike Rapoport

From: Mike Rapoport <[email protected]>

Commit 1355c31eeb7e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()") converted parisc to use generic version of pmd_alloc_one() but it missed the fact that parisc uses order-1 pages for PMD.

Quoted 8 lines
Quoted 6 lines

Restore the original version of pmd_alloc_one() for parisc, just use GFP_PGTABLE_KERNEL that implies __GFP_ZERO instead of GFP_KERNEL and memset.

Fixes 1355c31eeb7e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()")

typo, "Reported-by"

Helge,

I presume this is going via parisc tree, do you mind fixing up while applying?

Quoted 42 lines
Quoted 40 lines

---

Hi,

I've trimmed the 'cc list relatively to the bug report and added parisc maintainers.

 arch/parisc/include/asm/pgalloc.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/parisc/include/asm/pgalloc.h +6 -0
index cc7ecc2ef55d..a6482b2ce0ea 100644
@@ -10,6 +10,7 @@
 
 #include <asm/cache.h>
 
+#define __HAVE_ARCH_PMD_ALLOC_ONE
 #define __HAVE_ARCH_PMD_FREE
 #define __HAVE_ARCH_PGD_FREE
 #include <asm-generic/pgalloc.h>
@@ -67,6 +68,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 			(__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT)));
 }
 
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+	return (pmd_t *)__get_free_pages(GFP_PGTABLE_KERNEL, PMD_ORDER);
+}
+
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 	if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
Signature · 1 line
2.26.2
Signature · 2 lines
Sincerely yours,
Mike.
#3 lore raw
Quoted 3 lines · Mike Rapoport

I presume this is going via parisc tree, do you mind fixing up while applying?

I'll take it directly to not miss rc1, and I'll fix up the typo too.

Linus

maintainer
#4 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Mike Rapoport

I presume this is going via parisc tree, do you mind fixing up while applying?

I'll take it directly to not miss rc1, and I'll fix up the typo too.

Thanks!
Helge

#5 lore raw
In reply to Linus Torvalds
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Mike Rapoport

I presume this is going via parisc tree, do you mind fixing up while applying?

I'll take it directly to not miss rc1, and I'll fix up the typo too.

Thanks!

Quoted 1 line

Linus

Signature · 2 lines
Sincerely yours,
Mike.