Skip to contentSkip to conversation

x86: clean up pgd_{c,d}tor

PATCH In review Jan Beulich 3 participants 6 messages Jul 18, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: clean up pgd_{c,d}tor

Giving pgd_ctor() a properly typed parameter allows eliminating a local variable. Adjust pgd_dtor() to match.

Also, pgd_ctor()'s clearing of the memory is redundant with the GFP_ZERO used for allocating it.

---
 arch/x86/mm/pgtable.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/x86/mm/pgtable.c +2 -6
@@ -62,14 +62,10 @@ static inline void pgd_list_del(pgd_t *p
 #define UNSHARED_PTRS_PER_PGD				\
 	(SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD)
 
-static void pgd_ctor(void *p)
+static void pgd_ctor(pgd_t *pgd)
 {
-	pgd_t *pgd = p;
 	unsigned long flags;
 
-	/* Clear usermode parts of PGD */
-	memset(pgd, 0, KERNEL_PGD_BOUNDARY*sizeof(pgd_t));
-
 	spin_lock_irqsave(&pgd_lock, flags);
 
 	/* If the pgd points to a shared pagetable level (either the
@@ -94,7 +90,7 @@ static void pgd_ctor(void *p)
 	spin_unlock_irqrestore(&pgd_lock, flags);
 }
 
-static void pgd_dtor(void *pgd)
+static void pgd_dtor(pgd_t *pgd)
 {
 	unsigned long flags; /* can be called from interrupt context */
 
#1 lore raw
Quoted 6 lines · Jan Beulich

Giving pgd_ctor() a properly typed parameter allows eliminating a local variable. Adjust pgd_dtor() to match.

Also, pgd_ctor()'s clearing of the memory is redundant with the GFP_ZERO used for allocating it.

Ack to the parameter type change. But there's already a patch in git to remove the redundant clear.

J

Quoted 42 lines
---
 arch/x86/mm/pgtable.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/x86/mm/pgtable.c +2 -7
@@ -62,14 +62,10 @@ static inline void pgd_list_del(pgd_t *p
 #define UNSHARED_PTRS_PER_PGD				\
 	(SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD)
 
-static void pgd_ctor(void *p)
+static void pgd_ctor(pgd_t *pgd)
 {
-	pgd_t *pgd = p;
 	unsigned long flags;
 
-	/* Clear usermode parts of PGD */
-	memset(pgd, 0, KERNEL_PGD_BOUNDARY*sizeof(pgd_t));
-
 	spin_lock_irqsave(&pgd_lock, flags);
 
 	/* If the pgd points to a shared pagetable level (either the
@@ -94,7 +90,7 @@ static void pgd_ctor(void *p)
 	spin_unlock_irqrestore(&pgd_lock, flags);
 }
 
-static void pgd_dtor(void *pgd)
+static void pgd_dtor(pgd_t *pgd)
 {
 	unsigned long flags; /* can be called from interrupt context */
 
 
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line

Jeremy Fitzhardinge <[email protected]> 18.07.08 16:52 >>>

Quoted 6 lines · Jan Beulich

Giving pgd_ctor() a properly typed parameter allows eliminating a local variable. Adjust pgd_dtor() to match.

Also, pgd_ctor()'s clearing of the memory is redundant with the GFP_ZERO used for allocating it.

Ack to the parameter type change. But there's already a patch in git to remove the redundant clear.

Again, I can't see this in my just refreshed tree - am I doing things wrong? Or is this due to the myriads of topic branches (which of course I don't check out all)?

Jan

#3 lore raw
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 2 lines
Quoted 2 lines

Jeremy Fitzhardinge <[email protected]> 18.07.08 16:52 >>>

Quoted 7 lines · Jan Beulich

Giving pgd_ctor() a properly typed parameter allows eliminating a local variable. Adjust pgd_dtor() to match.

Also, pgd_ctor()'s clearing of the memory is redundant with the GFP_ZERO used for allocating it.

Quoted 7 lines
Quoted 2 lines

Ack to the parameter type change. But there's already a patch in git to remove the redundant clear.

Again, I can't see this in my just refreshed tree - am I doing things wrong? Or is this due to the myriads of topic branches (which of course I don't check out all)?

No, the changes are in mainline linux-2.6.git, though you should be able to find them in master in tip.git.

J

#5 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

Giving pgd_ctor() a properly typed parameter allows eliminating a local variable. Adjust pgd_dtor() to match.

Also, pgd_ctor()'s clearing of the memory is redundant with the GFP_ZERO used for allocating it.

This patch appears stale.

-hpa