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


Groups > linux.kernel > #1184194 > unrolled thread

Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader

Started byDavid Ahern <dsahern@gmail.com>
First post2015-07-15 04:10 +0200
Last post2015-07-15 15:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader David Ahern <dsahern@gmail.com> - 2015-07-15 04:10 +0200
    Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader Oleg Nesterov <oleg@redhat.com> - 2015-07-15 15:40 +0200

#1184194 — Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader

FromDavid Ahern <dsahern@gmail.com>
Date2015-07-15 04:10 +0200
SubjectRe: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader
Message-ID<pMkiZ-1RP-7@gated-at.bofh.it>
On 7/14/15 1:47 PM, Oleg Nesterov wrote:
> On 07/06, Andrey Vagin wrote:
>>
>> From: David Ahern <dsahern@gmail.com>
>>
>> threads of a process share the same VMAs, so when dumping all threads
>> for all processes only push vma data for group leader.
>
> ...
>
>> @@ -492,6 +493,13 @@ static int task_diag_fill(struct task_struct *tsk, struct sk_buff *skb,
>>   	}
>>
>>   	if (show_flags & TASK_DIAG_SHOW_VMA) {
>> +		/* if the request is to dump all threads of all processes
>> +		 * only show VMAs for group leader.
>> +		 */
>> +		if (req->dump_strategy == TASK_DIAG_DUMP_ALL_THREAD &&
>> +		    !thread_group_leader(tsk))
>> +			goto done;
>> +
>
> This doesn't look right, group leader can be a zombie with ->mm == NULL,

Seriously? I'll find some way to track whether VMAs have been dumped for 
a pid.

>
>>   		if (i >= n)
>>   			err = fill_vma(tsk, skb, cb, &progress, show_flags);
>
> so this probably needs something like find_lock_task_mm().

ok.

Thanks for the review,
David

--
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/

[toc] | [next] | [standalone]


#1184807

FromOleg Nesterov <oleg@redhat.com>
Date2015-07-15 15:40 +0200
Message-ID<pMv4L-va-25@gated-at.bofh.it>
In reply to#1184194
On 07/14, David Ahern wrote:
>
> On 7/14/15 1:47 PM, Oleg Nesterov wrote:
>>>
>>>   	if (show_flags & TASK_DIAG_SHOW_VMA) {
>>> +		/* if the request is to dump all threads of all processes
>>> +		 * only show VMAs for group leader.
>>> +		 */
>>> +		if (req->dump_strategy == TASK_DIAG_DUMP_ALL_THREAD &&
>>> +		    !thread_group_leader(tsk))
>>> +			goto done;
>>> +
>>
>> This doesn't look right, group leader can be a zombie with ->mm == NULL,
>
> Seriously?

Yes, the main thread can do sys_exit() / pthread_exit(), although this
is not that common.

> I'll find some way to track whether VMAs have been dumped for
> a pid.

In case I confused you, the thread_group_leader() check and "goto done"
above are fine, just you can't trust tsk->mm, so

>>>   		if (i >= n)
>>>   			err = fill_vma(tsk, skb, cb, &progress, show_flags);
>>
>> so this probably needs something like find_lock_task_mm().
>
> ok.

Yes, you just need to (try) find a subthread with ->mm != NULL if !tsk->mm,
find_lock_task_mm() can help.

Oleg.

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web