From nobody Fri Aug 4 18:43:36 2023 X-Original-To: dev-commits-src-all@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 4RHZNm6blmz4gstL; Fri, 4 Aug 2023 18:43:36 +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 4RHZNm65Chz4M72; Fri, 4 Aug 2023 18:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691174616; 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=5Ldwn24VhcYhBpCvC4t2ntzGhIG4zEY5O+P3Q0eSpqY=; b=LLQsT7H2T6HbfVfq4c+QmFYCTPtsTtwoItgL98BOWKFBihpDK6Rx2Ay/Y3FetxVZEZcugA NRCqbGZiKUusYMg6IVKQ8YtN3hcj68NIxt8B2UqM8bc7U+rJK4RrNWEMBLAaXg/+Y4OjAL RC1IJPx4WoZlnfGTXXQbgIK5X3sTKgYEHK6KShegroyCknkHsCW0DHZ00D/f6n9EsdhZaP ncXgxNQ/f8EFv2Wd2SvD5fP+jeM8BrMrZ8YJd5IeWLCU7brGpac+EnEWCk1a4dizRKOcY2 NgW36hf7x8gMbqtmO5MtTVrzHQEYr8Dwq4hWwSqIYQTtlrMZRNyrWtXyYP4B8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691174616; 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=5Ldwn24VhcYhBpCvC4t2ntzGhIG4zEY5O+P3Q0eSpqY=; b=YxpAJxMqhT0AWcV7EAx3k3mAGJZ9jlOffHPT0gZzUvLqLmSPj+PDV3VWvmn401dcd/+CeS qlmGnLILIcQ/DmL2gEjCg221gtroESrmGnY0+aGbFVyjJlhF9EG3OorSkFpYcdPhK03/rc wQif3allVGhTaEaIYqHZrnzNJgzqqq5LbirVqycRJkldGNzw9v1lhUSdwAxnrQEztz8SsC 3pwC35zUjNtVs08wKxtO7zbFiJBr49+RPgST3RWUnY0PBYeqKg1Mq8CMnQq9fd7tGVnIie 0gSsWcG7+uF1NLN/W+n9h81FlZj9Z79VpDUU+47nUWs9sWRcrJCDc97QhEBGsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691174616; a=rsa-sha256; cv=none; b=w89RXemArByc7CP+wcR0R2gehKcXTVtUnn6waKB9ySqfW2kY3I+dTFgLKYLMNZln9eSmxs G/tK8bdEmzBK7mYxSXxCsiOZI9DZ7EacRxcGyhbAtQvA6wT1AEfft/fSz4vYdVpjfctAwi BF7UOWzD2RSeSQuvyeXlMVkqHEv/1J7OU3aMpEAD8MDl7UoLVoczl84dqjcu+w0fUJRPL5 /eDpEKnrnzRjIAEVlni2pFGO1C+tjmJ1rUR/GA2X1dVHsAKBlHr/6aGgMsK8Bo+5JRr/aI CW9DwvE2wyGmo/4fbgKArZ3HZ+poqqdv7GgH5r99RiMdi2sJnAcE6/h0g+K6WA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RHZNm55nZz1D2T; Fri, 4 Aug 2023 18:43:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 374IhaQ5060301; Fri, 4 Aug 2023 18:43:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 374IhapQ060300; Fri, 4 Aug 2023 18:43:36 GMT (envelope-from git) Date: Fri, 4 Aug 2023 18:43:36 GMT Message-Id: <202308041843.374IhapQ060300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: ccdb28275db7 - main - vm_phys_enq_range: no alignment assert for npages==0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccdb28275db7c94ffdafc542d9e29fd43f51f39b Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=ccdb28275db7c94ffdafc542d9e29fd43f51f39b commit ccdb28275db7c94ffdafc542d9e29fd43f51f39b Author: Doug Moore AuthorDate: 2023-08-04 18:41:59 +0000 Commit: Doug Moore CommitDate: 2023-08-04 18:41:59 +0000 vm_phys_enq_range: no alignment assert for npages==0 Do not assume that when vm_phys_enq_range is passed npages==0 that the vm_page argument is valid in any way, much less that it has a page-aligned address. Just don't look at it. Assert nothing about it. Reported by: karels Differential Revision: https://reviews.freebsd.org/D41317 --- sys/vm/vm_phys.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index ed358d7cd4a9..a3af3964fba4 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -690,15 +690,17 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order, * term fragmentation by promoting contemporaneous allocation and (hopefully) * deallocation. * - * The physical page m's buddy must not be free. + * If npages is zero, this function does nothing and ignores the physical page + * parameter m. Otherwise, the physical page m's buddy must not be free. */ static vm_page_t vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) { int order; - KASSERT(((VM_PAGE_TO_PHYS(m) + npages * PAGE_SIZE) & - ((PAGE_SIZE << fls(npages / 2)) - 1)) == 0, + KASSERT(npages == 0 || + ((VM_PAGE_TO_PHYS(m) + npages * PAGE_SIZE) & + ((PAGE_SIZE << (fls(npages) - 1)) - 1)) == 0, ("vm_phys_enq_range: page %p and npages %u are misaligned", m, npages)); while (npages > 0) {