Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752503AbbGOCCf (ORCPT ); Tue, 14 Jul 2015 22:02:35 -0400 Received: from mail-qk0-f175.google.com ([209.85.220.175]:36075 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751241AbbGOCCe (ORCPT ); Tue, 14 Jul 2015 22:02:34 -0400 Message-ID: <55A5BF2B.1040504@gmail.com> Date: Tue, 14 Jul 2015 22:02:19 -0400 From: David Ahern User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Oleg Nesterov , 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 , Andy Lutomirski , Pavel Odintsov Subject: Re: [PATCH 12/24] task_diag: add a new group to get tasks memory mappings (v2) References: <1436172445-6979-1-git-send-email-avagin@openvz.org> <1436172445-6979-13-git-send-email-avagin@openvz.org> <20150714180857.GC8088@redhat.com> In-Reply-To: <20150714180857.GC8088@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 832 Lines: 37 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/