From owner-svn-src-stable-11@freebsd.org Fri Aug 18 20:20:50 2017 Return-Path: Delivered-To: svn-src-stable-11@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 DD802DD4582; Fri, 18 Aug 2017 20:20:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA22D73B5B; Fri, 18 Aug 2017 20:20:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7IKKnbO011467; Fri, 18 Aug 2017 20:20:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7IKKnlA011466; Fri, 18 Aug 2017 20:20:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201708182020.v7IKKnlA011466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 18 Aug 2017 20:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322673 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 322673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2017 20:20:51 -0000 Author: markj Date: Fri Aug 18 20:20:49 2017 New Revision: 322673 URL: https://svnweb.freebsd.org/changeset/base/322673 Log: MFC r322391: Micro-optimize kmem_unback(). Modified: stable/11/sys/vm/vm_kern.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_kern.c ============================================================================== --- stable/11/sys/vm/vm_kern.c Fri Aug 18 18:55:07 2017 (r322672) +++ stable/11/sys/vm/vm_kern.c Fri Aug 18 20:20:49 2017 (r322673) @@ -386,17 +386,19 @@ retry: void kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size) { - vm_page_t m; - vm_offset_t i, offset; + vm_page_t m, next; + vm_offset_t end, offset; KASSERT(object == kmem_object || object == kernel_object, ("kmem_unback: only supports kernel objects.")); pmap_remove(kernel_pmap, addr, addr + size); offset = addr - VM_MIN_KERNEL_ADDRESS; + end = offset + size; VM_OBJECT_WLOCK(object); - for (i = 0; i < size; i += PAGE_SIZE) { - m = vm_page_lookup(object, atop(offset + i)); + for (m = vm_page_lookup(object, atop(offset)); offset < end; + offset += PAGE_SIZE, m = next) { + next = vm_page_next(m); vm_page_unwire(m, PQ_NONE); vm_page_free(m); }