[Resend] [Hugetlb x86] 3/3 Check p?d_present in huge_pte_offset()

From: Adam Litke (agl_at_us.ibm.com)
Date: 08/26/05

  • Next message: Gerhard Wichert: "[PATCH 2.6.12] x86_64/kernel/time.c"
    To: akpm@osdl.org
    Date:	Fri, 26 Aug 2005 09:09:26 -0500
    
    

    Initial Post (Wed, 17 Aug 2005)

    For demand faulting, we cannot assume that the page tables will be populated.
    Do what the rest of the architectures do and test p?d_present() while walking
    down the page table.

    Diffed against 2.6.13-rc6

    Signed-off-by: Adam Litke <agl@us.ibm.com>

    ---
     hugetlbpage.c |    7 +++++--
     1 files changed, 5 insertions(+), 2 deletions(-)
    diff -upN reference/arch/i386/mm/hugetlbpage.c current/arch/i386/mm/hugetlbpage.c
    --- reference/arch/i386/mm/hugetlbpage.c
    +++ current/arch/i386/mm/hugetlbpage.c
    @@ -46,8 +46,11 @@ pte_t *huge_pte_offset(struct mm_struct 
     	pmd_t *pmd = NULL;
     
     	pgd = pgd_offset(mm, addr);
    -	pud = pud_offset(pgd, addr);
    -	pmd = pmd_offset(pud, addr);
    +	if (pgd_present(*pgd)) {
    +		pud = pud_offset(pgd, addr);
    +		if (pud_present(*pud))
    +			pmd = pmd_offset(pud, addr);
    +	}
     	return (pte_t *) pmd;
     }
     
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Gerhard Wichert: "[PATCH 2.6.12] x86_64/kernel/time.c"

    Relevant Pages

    • Re: [Hugetlb x86] 3/3 Check p?d_present in huge_pte_offset()
      ... For demand faulting, we cannot assume that the page tables will be populated. ... Do what the rest of the architectures do and test p?d_presentwhile walking ... return pmd; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] Remove some divide instructions
      ... >other architectures may want to do other things, ... due to the assignment to __base, the shift / mask optimization does not ... optimizations do not propagate through the assignment. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH 3/9] mm: parisc pte atomicity
      ... /* Simple function to work out if we have an existing address translation ... * for a user space vma. ... pmd_t *pmd; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [bugfix] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap()
      ... It may be more of an issue with architectures that actually *do* do ... I don't see anyone getting motivated enough to rewrite the ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)
    • Re: [Discuss][i386] Platform SMIs and their interferance with tsc based delay calibration
      ... We increase the delay calibration time and also identify any ... From a maintainability POV it's not good that x86 is no longer using the ... architectures must implement arch_calibrate_delay, then provide stubs for ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)