aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-01-30 07:33:40 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:40 -0500
commit508bebbb1f211fbf3f392feea44218045096f240 (patch)
treec4f4eca616dd8f6e9739281022f84d70f9d5e2a7
parent8fe3deef013bebdbed1f75ae59ef9707fb6e5cc7 (diff)
x86: allocate and initialize unshared pmds
If SHARED_KERNEL_PMD is false, then we need to allocate and initialize the kernel pmd. We can easily piggy-back this onto the existing pmd prepopulation code. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/mm/pgtable_32.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 33ddddfc26b0..3a6c9200058d 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -305,7 +305,7 @@ static void pgd_mop_up_pmds(pgd_t *pgdp)
305{ 305{
306 int i; 306 int i;
307 307
308 for(i = 0; i < USER_PTRS_PER_PGD; i++) { 308 for(i = 0; i < UNSHARED_PTRS_PER_PGD; i++) {
309 pgd_t pgd = pgdp[i]; 309 pgd_t pgd = pgdp[i];
310 310
311 if (pgd_val(pgd) != 0) { 311 if (pgd_val(pgd) != 0) {
@@ -325,6 +325,10 @@ static void pgd_mop_up_pmds(pgd_t *pgdp)
325 * processor notices the update. Since this is expensive, and 325 * processor notices the update. Since this is expensive, and
326 * all 4 top-level entries are used almost immediately in a 326 * all 4 top-level entries are used almost immediately in a
327 * new process's life, we just pre-populate them here. 327 * new process's life, we just pre-populate them here.
328 *
329 * Also, if we're in a paravirt environment where the kernel pmd is
330 * not shared between pagetables (!SHARED_KERNEL_PMDS), we allocate
331 * and initialize the kernel pmds here.
328 */ 332 */
329static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd) 333static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd)
330{ 334{
@@ -333,7 +337,8 @@ static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd)
333 int i; 337 int i;
334 338
335 pud = pud_offset(pgd, 0); 339 pud = pud_offset(pgd, 0);
336 for (addr = i = 0; i < USER_PTRS_PER_PGD; i++, pud++, addr += PUD_SIZE) { 340 for (addr = i = 0; i < UNSHARED_PTRS_PER_PGD;
341 i++, pud++, addr += PUD_SIZE) {
337 pmd_t *pmd = pmd_alloc_one(mm, addr); 342 pmd_t *pmd = pmd_alloc_one(mm, addr);
338 343
339 if (!pmd) { 344 if (!pmd) {
@@ -341,6 +346,10 @@ static int pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd)
341 return 0; 346 return 0;
342 } 347 }
343 348
349 if (i >= USER_PTRS_PER_PGD)
350 memcpy(pmd, (pmd_t *)pgd_page_vaddr(swapper_pg_dir[i]),
351 sizeof(pmd_t) * PTRS_PER_PMD);
352
344 pud_populate(mm, pud, pmd); 353 pud_populate(mm, pud, pmd);
345 } 354 }
346 355
@@ -444,4 +453,3 @@ void check_pgt_cache(void)
444{ 453{
445 quicklist_trim(0, pgd_dtor, 25, 16); 454 quicklist_trim(0, pgd_dtor, 25, 16);
446} 455}
447