From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbbGNRst (ORCPT ); Tue, 14 Jul 2015 13:48:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33320 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbbGNRsr (ORCPT ); Tue, 14 Jul 2015 13:48:47 -0400 Date: Tue, 14 Jul 2015 19:47:03 +0200 From: Oleg Nesterov To: Andrey Vagin Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andrew Morton , Cyrill Gorcunov , Pavel Emelyanov , Roger Luethi , Arnd Bergmann , Arnaldo Carvalho de Melo , David Ahern , Andy Lutomirski , Pavel Odintsov Subject: Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader Message-ID: <20150714174703.GA8088@redhat.com> References: <1436172445-6979-1-git-send-email-avagin@openvz.org> <1436172445-6979-21-git-send-email-avagin@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436172445-6979-21-git-send-email-avagin@openvz.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/06, Andrey Vagin wrote: > > From: David Ahern > > 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, > if (i >= n) > err = fill_vma(tsk, skb, cb, &progress, show_flags); so this probably needs something like find_lock_task_mm(). Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH 20/24] task_diag: Only add VMAs for thread_group leader Date: Tue, 14 Jul 2015 19:47:03 +0200 Message-ID: <20150714174703.GA8088@redhat.com> References: <1436172445-6979-1-git-send-email-avagin@openvz.org> <1436172445-6979-21-git-send-email-avagin@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1436172445-6979-21-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andrey Vagin Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andrew Morton , Cyrill Gorcunov , Pavel Emelyanov , Roger Luethi , Arnd Bergmann , Arnaldo Carvalho de Melo , David Ahern , Andy Lutomirski , Pavel Odintsov List-Id: linux-api@vger.kernel.org On 07/06, Andrey Vagin wrote: > > From: David Ahern > > 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, > if (i >= n) > err = fill_vma(tsk, skb, cb, &progress, show_flags); so this probably needs something like find_lock_task_mm(). Oleg.