From owner-freebsd-hackers@freebsd.org Thu Jul 7 01:55:58 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1388B7561F for ; Thu, 7 Jul 2016 01:55:58 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell1.rawbw.com (shell1.rawbw.com [198.144.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id B11AE15F7 for ; Thu, 7 Jul 2016 01:55:58 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from yuri.doctorlan.com (c-24-5-143-190.hsd1.ca.comcast.net [24.5.143.190]) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id u671tvPj042010 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 6 Jul 2016 18:55:57 -0700 (PDT) (envelope-from yuri@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host c-24-5-143-190.hsd1.ca.comcast.net [24.5.143.190] claimed to be yuri.doctorlan.com Subject: Re: Why kinfo_getvmmap is sometimes so expensive? To: Konstantin Belousov References: <20160707001913.GJ38613@kib.kiev.ua> Cc: Freebsd hackers list From: Yuri Message-ID: <0b5c9018-2b12-e993-a6df-06ecad6a7b07@rawbw.com> Date: Wed, 6 Jul 2016 18:55:56 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160707001913.GJ38613@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2016 01:55:58 -0000 On 07/06/2016 17:19, Konstantin Belousov wrote: > To calculate residency count for the process map entries, kernel has to > iterate over all pages. This operation was somewhat optimized in 10.3 > and HEAD, particularly for the large sparce mappings. But for large populated > mappings there is no other way then to check each page. > > You may confirm my hypothesis by setting sysctl > kern.proc_vmmap_skip_resident_count to 0 and see whether the CPU > consumption changed. Of course, you will not get the resident count > in the returned structure, after the knob is tweaked. Yes, this explains it. kern.proc_vmmap_skip_resident_count=0 made CPU consumption to go down. So, it is better to parse /proc//map to get the process size. Thank you, Yuri