LKML Archive on
help / color / mirror / Atom feed
* How to get the PTE pointer for a linear address?
@ 2008-10-17  7:07 Peter Teoh
  0 siblings, 0 replies; only message in thread
From: Peter Teoh @ 2008-10-17  7:07 UTC (permalink / raw)
  To: LKML

If I allocate kernel memory via alloc_page(GFP_KERNEL),  and convert
that struct page pointer to linear address via page_address(), how do
I derive the PTE pointer of that page?

Following the source code, I did the following:

        pgd_t *pgd = pgd_offset_k(address);

        if (pgd_none(*pgd)) {
                printk("no pgd ");
                return 0;
        pud = pud_offset(pgd, address);
        if (pud_none(*pud)) {
                printk("no pud ");
                return 0;
        pmd = pmd_offset(pud, address);
        if (pmd_none(*pmd)) {
                printk("no pmd ");
                return 0;

        pte = pte_offset_map(pmd, address);

===============> and in between here, the PTE pointer is returned
(from pte_offset_map())?   And so the PTE structure (pte_t) should be


I suspect something is not right?

Peter Teoh

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-17  7:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-17  7:07 How to get the PTE pointer for a linear address? Peter Teoh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).