From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 4 09:55:23 2014 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4335D4C for ; Fri, 4 Jul 2014 09:55:23 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BC552695 for ; Fri, 4 Jul 2014 09:55:23 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.8/8.14.8) with ESMTP id s649tNLq017886 for ; Fri, 4 Jul 2014 10:55:23 +0100 (BST) (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 188911] [libc] sysctl(KERN_PROC_VMMAP) takes too long Date: Fri, 04 Jul 2014 09:55:23 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: In Discussion X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2014 09:55:23 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=188911 --- Comment #4 from Konstantin Belousov --- Created attachment 144398 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=144398&action=edit suggested change The existing calculation of the resident page count in kern_proc_vmmap_out() does not make sense. It counts the number of installed pte's in the specified range, which can be less than the number of resident pages, if the pages are not faulted on yet (i.e. softfault case). The patch does two things: 1. it adds a tunable to disable the calculation of the resident count at all. sysctl kern.proc_vmmap_skip_resident_count; 2. it changes the algorithm for calculation to count the number of pages which are resident for the read fault, the COW copy allocations are counted as resident, while they are really not. I am on the edge WRT disabling the calculation by default, the patch does disable. One interesting consequence of the new algorithm is that the provided test case is executed in zero time even with the residency count calculation enabled. The reason is that there is no backing object for the mapping which was never faulted on. As result, the loop is not executed at all. If I change the test case to access at least one page in the mmaped range before calling sysctl, I get around 30 sec runtime on my i7 2600K. -- You are receiving this mail because: You are the assignee for the bug.