pgd_t *pgd = pgd_offset(current->mm, address); pmd_t *pmd = pmd_offset(pgd, address); pte_t *pte = pte_offset_map(pmd, address); pte_t _pte = *pte; pte_unmap(pte);
return pte_val(_pte) & PTE_MASK;
Nothing unusual here. The question is, do I need to protect this code with a spinlock? That is, should I change the above to:
spin_lock(¤t->mm->page_table_lock); pgd_t *pgd = pgd_offset(current->mm, address); pmd_t *pmd = pmd_offset(pgd, address); pte_t *pte = pte_offset_map(pmd, address); pte_t _pte = *pte; pte_unmap(pte); spin_unlock(¤t->mm->page_table_lock);
I'm guessing I only need to call a spinlock if the page isn't locked in memory. Is that correct?
-- Timur Tabi Staff Software Engineer timur.tabi@ammasso.com
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/