From owner-svn-src-stable@freebsd.org Mon Dec 4 15:18:09 2017 Return-Path: Delivered-To: svn-src-stable@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 C37C5DFEC81; Mon, 4 Dec 2017 15:18:09 +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 9AA2F6B8BD; Mon, 4 Dec 2017 15:18:09 +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 vB4FI87C048700; Mon, 4 Dec 2017 15:18:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB4FI8KR048697; Mon, 4 Dec 2017 15:18:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201712041518.vB4FI8KR048697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 4 Dec 2017 15:18:08 +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: r326529 - 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: 326529 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@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2017 15:18:09 -0000 Author: markj Date: Mon Dec 4 15:18:08 2017 New Revision: 326529 URL: https://svnweb.freebsd.org/changeset/base/326529 Log: MFC r326234, r326235, r326284: vm_page_array initialization improvements. Modified: stable/11/sys/vm/vm_page.c stable/11/sys/vm/vm_phys.c stable/11/sys/vm/vm_phys.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_page.c ============================================================================== --- stable/11/sys/vm/vm_page.c Mon Dec 4 13:28:56 2017 (r326528) +++ stable/11/sys/vm/vm_page.c Mon Dec 4 15:18:08 2017 (r326529) @@ -408,6 +408,29 @@ vm_page_domain_init(struct vm_domain *vmd) } /* + * Initialize a physical page in preparation for adding it to the free + * lists. + */ +static void +vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind) +{ + + m->object = NULL; + m->wire_count = 0; + m->busy_lock = VPB_UNBUSIED; + m->hold_count = 0; + m->flags = 0; + m->phys_addr = pa; + m->queue = PQ_NONE; + m->psind = 0; + m->segind = segind; + m->order = VM_NFREEORDER; + m->pool = VM_FREEPOOL_DEFAULT; + m->valid = m->dirty = 0; + pmap_page_init(m); +} + +/* * vm_page_startup: * * Initializes the resident memory module. Allocates physical memory for @@ -654,8 +677,9 @@ vm_page_startup(vm_offset_t vaddr) vm_cnt.v_free_count = 0; for (segind = 0; segind < vm_phys_nsegs; segind++) { seg = &vm_phys_segs[segind]; - for (pa = seg->start; pa < seg->end; pa += PAGE_SIZE) - vm_phys_init_page(pa); + for (m = seg->first_page, pa = seg->start; pa < seg->end; + m++, pa += PAGE_SIZE) + vm_page_init_page(m, pa, segind); /* * Add the segment to the free lists only if it is covered by Modified: stable/11/sys/vm/vm_phys.c ============================================================================== --- stable/11/sys/vm/vm_phys.c Mon Dec 4 13:28:56 2017 (r326528) +++ stable/11/sys/vm/vm_phys.c Mon Dec 4 15:18:08 2017 (r326529) @@ -175,7 +175,6 @@ static vm_page_t vm_phys_alloc_seg_contig(struct vm_ph vm_paddr_t boundary); static void _vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end, int domain); static void vm_phys_create_seg(vm_paddr_t start, vm_paddr_t end); -static int vm_phys_paddr_to_segind(vm_paddr_t pa); static void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order); @@ -731,31 +730,6 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_f } /* - * Initialize a physical page in preparation for adding it to the free - * lists. - */ -void -vm_phys_init_page(vm_paddr_t pa) -{ - vm_page_t m; - - m = vm_phys_paddr_to_vm_page(pa); - m->object = NULL; - m->wire_count = 0; - m->busy_lock = VPB_UNBUSIED; - m->hold_count = 0; - m->flags = m->aflags = m->oflags = 0; - m->phys_addr = pa; - m->queue = PQ_NONE; - m->psind = 0; - m->segind = vm_phys_paddr_to_segind(pa); - m->order = VM_NFREEORDER; - m->pool = VM_FREEPOOL_DEFAULT; - m->valid = m->dirty = 0; - pmap_page_init(m); -} - -/* * Allocate a contiguous, power of two-sized set of physical pages * from the free lists. * @@ -1061,24 +1035,6 @@ vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_pa rw_wunlock(&vm_phys_fictitious_reg_lock); free(seg->first_page, M_FICT_PAGES); free(seg, M_FICT_PAGES); -} - -/* - * Find the segment containing the given physical address. - */ -static int -vm_phys_paddr_to_segind(vm_paddr_t pa) -{ - struct vm_phys_seg *seg; - int segind; - - for (segind = 0; segind < vm_phys_nsegs; segind++) { - seg = &vm_phys_segs[segind]; - if (pa >= seg->start && pa < seg->end) - return (segind); - } - panic("vm_phys_paddr_to_segind: paddr %#jx is not in any segment" , - (uintmax_t)pa); } /* Modified: stable/11/sys/vm/vm_phys.h ============================================================================== --- stable/11/sys/vm/vm_phys.h Mon Dec 4 13:28:56 2017 (r326528) +++ stable/11/sys/vm/vm_phys.h Mon Dec 4 15:18:08 2017 (r326529) @@ -82,7 +82,6 @@ vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa) void vm_phys_free_contig(vm_page_t m, u_long npages); void vm_phys_free_pages(vm_page_t m, int order); void vm_phys_init(void); -void vm_phys_init_page(vm_paddr_t pa); vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); vm_page_t vm_phys_scan_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, int options);