vm locking question

Borislav Deianov (borislav@lix.polytechnique.fr)
Wed, 12 Apr 2000 23:35:06 +0200


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/