Hi
I'm doing some manipulations with page table entries, specifically
reading and clearing the dirty flag. Here's a code snippet of how I'm
obtaining the page table entries:
down_read(&task->mm->mmap_sem);
spin_lock(&task->mm->page_table_lock);
-- loop over some addresses:
pgd = task->mm->pgd + pgd_index(addr);
pud = pud_offset(pgd, addr);
pmd = pmd_offset(pud, addr);
pte = pte_offset_map_lock(task->mm, pmd, addr, &ptl);
--- play around with pte
pte_unmap_unlock(pte - 1, ptl);
spin_unlock(&task->mm->page_table_lock);
up_read(&task->mm->mmap_sem);
For some reason, this code will freeze the system every now and
then, within the pte_offset_map_lock call. It doesn't happen with all
processes; running it on bash, bzip and similar applications works fine.
But when I run it on large X apps it happens, as well as when I run it
on the calling process (i.e. when examining user space pages from the
current process context).
I suspect that I'm doing something wrong with the locks (not
surprisingly, since it freezes during lock acquisition), but I can't
figure out what. Do I need another lock? Wrong lock order?
Thanks in advance for any hints!
Joe Schmid
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ