Skip to contentSkip to conversation

i386: remove dead code in pgtable_cache_init

PATCH In review Jeremy Fitzhardinge 2 participants 3 messages Oct 10, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: remove dead code in pgtable_cache_init

The conversion from using a slab cache to quicklist left some residual dead code.

I note that in the conversion it now always allocates a whole page for the pgd, rather than the 32 bytes needed for a PAE pgd. Was this intended?

Cc Christoph Lameter <[email protected]>
Cc Andi Kleen <[email protected]>
Cc William Lee Irwin III <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/i386/mm/init.c |   22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

===================================================================

arch/i386/mm/init.c +5 -17
@@ -746,24 +746,12 @@ struct kmem_cache *pmd_cache;
 
 void __init pgtable_cache_init(void)
 {
-	size_t pgd_size = PTRS_PER_PGD*sizeof(pgd_t);
-
-	if (PTRS_PER_PMD > 1) {
+	if (PTRS_PER_PMD > 1)
 		pmd_cache = kmem_cache_create("pmd",
-					PTRS_PER_PMD*sizeof(pmd_t),
-					PTRS_PER_PMD*sizeof(pmd_t),
-					SLAB_PANIC,
-					pmd_ctor);
-		if (!SHARED_KERNEL_PMD) {
-			/* If we're in PAE mode and have a non-shared
-			   kernel pmd, then the pgd size must be a
-			   page size.  This is because the pgd_list
-			   links through the page structure, so there
-			   can only be one pgd per page for this to
-			   work. */
-			pgd_size = PAGE_SIZE;
-		}
-	}
+					      PTRS_PER_PMD*sizeof(pmd_t),
+					      PTRS_PER_PMD*sizeof(pmd_t),
+					      SLAB_PANIC,
+					      pmd_ctor);
 }
 
 /*
#1 lore raw
Quoted 5 lines · Jeremy Fitzhardinge

The conversion from using a slab cache to quicklist left some residual dead code.

I note that in the conversion it now always allocates a whole page for the pgd, rather than the 32 bytes needed for a PAE pgd. Was this intended?

I believe that virtualization support needed a full pgd.

#2 lore raw
Quoted 2 lines · Christoph Lameter

I believe that virtualization support needed a full pgd.

Yes, Xen requires it for PAE pgds, at least at the moment. But native, lguest, vmi and kvm don't. I'd made it so that the memory overhead was only paid in the Xen case. Allocating a whole page all the time certainly simplifies things, but at the cost of more overhead for everyone.

If we move away from using the page->private field to link the pgds together, then I can probably remove Xen's need to allocate a whole page for PAE pgds.

J