On 07/06, Andrey Vagin wrote:
>
> +static int task_vma_num(struct mm_struct *mm)
> +{
> +     struct vm_area_struct *vma;
> +     int n_vma = 0;
> +
> +     if (!mm || !atomic_inc_not_zero(&mm->mm_users))
> +             return 0;
> +
> +     down_read(&mm->mmap_sem);
> +     for (vma = mm->mmap; vma; vma = vma->vm_next, n_vma++)
> +             ;
> +
> +     up_read(&mm->mmap_sem);
> +     mmput(mm);
> +
> +     return n_vma;
> +}

Hmm. How about

        int task_vma_num(struct mm_struct *mm)
        {
                return mm->map_count;
        }

?

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to