From nobody Sun Jul 17 11:24:19 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lm2mg73Nzz4T2Mf; Sun, 17 Jul 2022 11:24:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lm2mg6LWbz3PKw; Sun, 17 Jul 2022 11:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658057059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NHwASov+9XPKr3uN7l2GI9mg3IEk9Kq4vGRTRIZyp3A=; b=m1/yKm9ckDXvznke1Z1XhDudh0c8EG2Wsf+A8D73RHQYa3Y0x+aIlhXBpnVcDQsUEcOvJb QA6bReFQahhau8hlg28Ce8HkqIqXbrC1M8uiXTveTZGzZsQcVM3YiXbJPKiHzlX4wYziQX pPX1K8q29Wq5kgsAigQTX+ampKFnR07UmOkWsAgRX/Tr1O/637lsKIAgzGuph3uUnasd/w olfl83zbPvG46Hu14iz7yJyaTzaZtw3WlULSx5LoR7QNtTiy2HnaIfeE1SSdqtLDRdSr1i 17RM2x7jyA9XKf1y29KpfRVorvVXTjb9mshp7zVqW1z4FPUdf4B5wnzULMktkQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lm2mg5RtFzyMn; Sun, 17 Jul 2022 11:24:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26HBOJ7C014275; Sun, 17 Jul 2022 11:24:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26HBOJG3014274; Sun, 17 Jul 2022 11:24:19 GMT (envelope-from git) Date: Sun, 17 Jul 2022 11:24:19 GMT Message-Id: <202207171124.26HBOJG3014274@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fff19e0ed2f3 - main - vm_object: Remove redundant OBJ_SWAP checks List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fff19e0ed2f3a56ee063f0ce1486b1dd35df6d6c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658057059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NHwASov+9XPKr3uN7l2GI9mg3IEk9Kq4vGRTRIZyp3A=; b=hYMZgz1yjLEl0RQGFTUexGDjhXBy+/dBQ/YkP+jPijPzkIwLEfnqHE7gG2Q1jTQ1ziGwNd BltB2mNgVbyCaPmqA+aiz5f4ODDNSo4R0IoHVDXUojUhJyKwJhGW5sRpJlVASFZblCzglz aqT2vdRTUtoA0lTevZmsYkhJWddUz10OPAwLG6KDf3NHgW5TN92HpU9fnhaMiRdubVR7eO JJ8XO0wpvqSAhNGYFY6r8nd7aQy4o8+iFPxMYA9QKpMHt/fpswbWlCPsg7jFqhkRKxYtr4 dgnIenGSRfAkhpc5S3miHWVmeN3eAnM1kvyfF3ydcwZgN2RPSv5ZRS40Wj7isQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658057059; a=rsa-sha256; cv=none; b=fqNnyICe0C4/s4vcOIqLTHcJROjsG+8hDgR/TOQjKmaK/HbdVaCahNXJvi8TnNoi8Nf47p 3e3Krc9pf/JsD3hj211cz+I76UBxr6cdcD0GXW5aDNhDp3nrX761HB9962XSbrAWUCsEu3 BYOCDx8AI6kksk+i/pQYAn6TkIiCQELwWPK9fdok7n4niqmYuwv7mtzIHOI41ctp2Cf9hw H9krfDlYS7beX5KJf8VNiAe9/blRTT7ljm5o4r2ZMibiYAmMiEo3L0UUunoGlY2ZcwBrdJ pgFrFYObMFpAlLqdPANiSfP8RW6PqlKaOE+up1YkfLWF0NG6YWdq986PTY0F9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fff19e0ed2f3a56ee063f0ce1486b1dd35df6d6c commit fff19e0ed2f3a56ee063f0ce1486b1dd35df6d6c Author: Mark Johnston AuthorDate: 2022-07-16 15:29:53 +0000 Commit: Mark Johnston CommitDate: 2022-07-17 11:09:48 +0000 vm_object: Remove redundant OBJ_SWAP checks With the removal of OBJT_DEFAULT, OBJ_ANON implies OBJ_SWAP. Note, this means that vm_object_split() is more expensive than it used to be, as it holds busy locks until the end of the range is reached, even if the object has no swap blocks allocated. Reviewed by: alc, kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35789 --- sys/vm/vm_object.c | 52 +++++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 7fd82239c13b..7304a42d9ae5 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1506,7 +1506,7 @@ vm_object_shadow(vm_object_t *object, vm_ooffset_t *offset, vm_size_t length, void vm_object_split(vm_map_entry_t entry) { - vm_page_t m, m_busy, m_next; + vm_page_t m, m_next; vm_object_t orig_object, new_object, backing_object; vm_pindex_t idx, offidxstart; vm_size_t size; @@ -1559,7 +1559,6 @@ vm_object_split(vm_map_entry_t entry) * that the object is in transition. */ vm_object_set_flag(orig_object, OBJ_SPLIT); - m_busy = NULL; #ifdef INVARIANTS idx = 0; #endif @@ -1622,26 +1621,17 @@ retry: */ vm_reserv_rename(m, new_object, orig_object, offidxstart); #endif - - /* - * orig_object's type may change while sleeping, so keep track - * of the beginning of the busied range. - */ - if (orig_object->type != OBJT_SWAP) - vm_page_xunbusy(m); - else if (m_busy == NULL) - m_busy = m; - } - if ((orig_object->flags & OBJ_SWAP) != 0) { - /* - * swap_pager_copy() can sleep, in which case the orig_object's - * and new_object's locks are released and reacquired. - */ - swap_pager_copy(orig_object, new_object, offidxstart, 0); - if (m_busy != NULL) - TAILQ_FOREACH_FROM(m_busy, &new_object->memq, listq) - vm_page_xunbusy(m_busy); } + + /* + * swap_pager_copy() can sleep, in which case the orig_object's + * and new_object's locks are released and reacquired. + */ + swap_pager_copy(orig_object, new_object, offidxstart, 0); + + TAILQ_FOREACH(m, &new_object->memq, listq) + vm_page_xunbusy(m); + vm_object_clear_flag(orig_object, OBJ_SPLIT); VM_OBJECT_WUNLOCK(orig_object); VM_OBJECT_WUNLOCK(new_object); @@ -1963,21 +1953,13 @@ vm_object_collapse(vm_object_t object) /* * Move the pager from backing_object to object. + * + * swap_pager_copy() can sleep, in which case the + * backing_object's and object's locks are released and + * reacquired. */ - if ((backing_object->flags & OBJ_SWAP) != 0) { - /* - * swap_pager_copy() can sleep, in which case - * the backing_object's and object's locks are - * released and reacquired. - * Since swap_pager_copy() is being asked to - * destroy backing_object, it will change the - * type to OBJT_DEFAULT. - */ - swap_pager_copy( - backing_object, - object, - OFF_TO_IDX(object->backing_object_offset), TRUE); - } + swap_pager_copy(backing_object, object, + OFF_TO_IDX(object->backing_object_offset), TRUE); /* * Object now shadows whatever backing_object did.