From owner-svn-src-head@freebsd.org Wed May 22 23:11:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C95471590821; Wed, 22 May 2019 23:11:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67D126F99D; Wed, 22 May 2019 23:11:17 +0000 (UTC) (envelope-from dougm@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 416C02447E; Wed, 22 May 2019 23:11:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MNBHGR053628; Wed, 22 May 2019 23:11:17 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MNBH7h053627; Wed, 22 May 2019 23:11:17 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201905222311.x4MNBH7h053627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 22 May 2019 23:11:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348128 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 348128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 67D126F99D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 23:11:18 -0000 Author: dougm Date: Wed May 22 23:11:16 2019 New Revision: 348128 URL: https://svnweb.freebsd.org/changeset/base/348128 Log: Cleanups made necessary by r348115, or reactions to it: 1. Change size_t to vm_size_t in some places. 2. Rename vm_map_entry_resize_free to drop the _free part. 3. Fix whitespace errors. 4. Fix screwups in patch-conflict-management that left out important changes related to growing and shrinking objects. Reviewed by: alc Approved by: kib (mentor) Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed May 22 23:07:40 2019 (r348127) +++ head/sys/vm/vm_map.c Wed May 22 23:11:16 2019 (r348128) @@ -1241,17 +1241,15 @@ vm_map_entry_unlink(vm_map_t map, } /* - * vm_map_entry_resize_free: + * vm_map_entry_resize: * - * Recompute the amount of free space following a modified vm_map_entry - * and propagate those values up the tree. Call this function after - * resizing a map entry in-place by changing the end value, without a - * call to vm_map_entry_link() or _unlink(). + * Resize a vm_map_entry, recompute the amount of free space that + * follows it and propagate that value up the tree. * * The map must be locked, and leaves it so. */ static void -vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t entry, size_t grow_amount) +vm_map_entry_resize(vm_map_t map, vm_map_entry_t entry, vm_size_t grow_amount) { vm_map_entry_t llist, rlist, root; @@ -1259,15 +1257,15 @@ vm_map_entry_resize_free(vm_map_t map, vm_map_entry_t root = map->root; root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist); KASSERT(root != NULL, - ("vm_map_entry_resize_free: resize_free object not mapped")); + ("%s: resize object not mapped", __func__)); vm_map_splay_findnext(root, &rlist); root->right = NULL; entry->end += grow_amount; map->root = vm_map_splay_merge(root, llist, rlist, root->left, root->right); VM_MAP_ASSERT_CONSISTENT(map); - CTR3(KTR_VM, "vm_map_entry_resize_free: map %p, nentries %d, entry %p", - map, map->nentries, entry); + CTR4(KTR_VM, "%s: map %p, nentries %d, entry %p", + _func__, map, map->nentries, entry); } /* @@ -1487,7 +1485,7 @@ charged: prev_entry)); if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0) map->size += end - prev_entry->end; - vm_map_entry_resize_free(map, prev_entry, + vm_map_entry_resize(map, prev_entry, end - prev_entry->end); vm_map_simplify_entry(map, prev_entry); return (KERN_SUCCESS); @@ -4168,7 +4166,7 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma struct vmspace *vm; struct ucred *cred; vm_offset_t gap_end, gap_start, grow_start; - size_t grow_amount, guard, max_grow; + vm_size_t grow_amount, guard, max_grow; rlim_t lmemlim, stacklim, vmemlim; int rv, rv1; bool gap_deleted, grow_down, is_procstack; @@ -4314,8 +4312,7 @@ retry: gap_deleted = true; } else { MPASS(gap_entry->start < gap_entry->end - grow_amount); - gap_entry->end -= grow_amount; - vm_map_entry_resize_free(map, gap_entry, -grow_amount); + vm_map_entry_resize(map, gap_entry, -grow_amount); gap_deleted = false; } rv = vm_map_insert(map, NULL, 0, grow_start, @@ -4329,7 +4326,7 @@ retry: MAP_CREATE_GUARD | MAP_CREATE_STACK_GAP_DN); MPASS(rv1 == KERN_SUCCESS); } else - vm_map_entry_resize_free(map, gap_entry, + vm_map_entry_resize(map, gap_entry, grow_amount); } } else { @@ -4344,13 +4341,16 @@ retry: vm_object_coalesce(stack_entry->object.vm_object, stack_entry->offset, (vm_size_t)(stack_entry->end - stack_entry->start), - (vm_size_t)grow_amount, cred != NULL)) { - if (gap_entry->start + grow_amount == gap_entry->end) + grow_amount, cred != NULL)) { + if (gap_entry->start + grow_amount == gap_entry->end) { vm_map_entry_delete(map, gap_entry); - else + vm_map_entry_resize(map, stack_entry, + grow_amount); + } else { gap_entry->start += grow_amount; + stack_entry->end += grow_amount; + } map->size += grow_amount; - vm_map_entry_resize_free(map, stack_entry, grow_amount); rv = KERN_SUCCESS; } else rv = KERN_FAILURE;