vm locking question

From: Borislav Deianov (borislav@lix.polytechnique.fr)
Date: Wed Apr 12 2000 - 16:35:06 EST


Hi,

For the atomic ps I'd like to scan the memory maps of all processes
without sleeping. This means I can't grab mmap_sem like the procfs
code does. I'm thinking of doing something like this:

read_lock(&tasklist_lock);
for_each_task(p) {
        ...
        if (p->mm) {
                atomic_inc(&p->mm_count);
                vmlist_access_lock(p->mm);
                for (vma = p->mm->mmap; vma; vma = vma->vm_next) {
                        ...
                }
                vmlist_access_unlock(p->mm);
                mmdrop(p->mm);
        }
        ...
}
read_unlock(&tasklist_lock);

Is this OK or will it get me in trouble (latency issues aside)?

Thanks,
Borislav

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:19 EST