From owner-freebsd-hackers@freebsd.org Thu Jul 7 22:32:35 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 9E8DCB82A69 for ; Thu, 7 Jul 2016 22:32:35 +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 8E7731CAF for ; Thu, 7 Jul 2016 22:32:35 +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 u67MWTFY074892 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Thu, 7 Jul 2016 15:32:29 -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? References: <20160707001913.GJ38613@kib.kiev.ua> To: Freebsd hackers list From: Yuri Message-ID: <6193bbf3-39cd-abaa-a5e4-0480c40dac55@rawbw.com> Date: Thu, 7 Jul 2016 15:32:28 -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 22:32:35 -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. When people raise the question of why malloc library doesn't unmap the memory, developers there usually say that they call madvise(MADV_FREE) and this is as good as unmap. But this example shows that this isn't quite the case on the FreeBSD, and unmapping is better. Yuri