Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1184193

Re: [PATCH 12/24] task_diag: add a new group to get tasks memory mappings (v2)

From David Ahern <dsahern@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 12/24] task_diag: add a new group to get tasks memory mappings (v2)
Date 2015-07-15 04:10 +0200
Message-ID <pMkiZ-1RP-5@gated-at.bofh.it> (permalink)
References <pJapQ-5WZ-3@gated-at.bofh.it> <pJapS-5WZ-67@gated-at.bofh.it> <pMcYa-85n-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 7/14/15 2:08 PM, Oleg Nesterov wrote:
> 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;
> 	}
>
> ?

makes sense. Thanks for the pointer.

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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 12/24] task_diag: add a new group to get tasks memory  mappings (v2) David Ahern <dsahern@gmail.com> - 2015-07-15 04:10 +0200

csiph-web