From nobody Thu Mar 31 21:23:01 2022 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 476351A4643B; Thu, 31 Mar 2022 21:23:02 +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 4KTx9L1Zzkz4cXn; Thu, 31 Mar 2022 21:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648761782; 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=b5QeKq3LOuWSkKejkTVytl0N9Z/a1tRZNDkPWGVbqoQ=; b=B5NTT0pWyUeeuiJWpjs0Tf9DSi5b6kyts0G/76kOixUT9SrjLOpKBJzrtnAGlPz8avtMAx eXChJy0EBKNEW8u5V3VGo4auPfC5kcB9Vg6aaGJ6EZPpHPPX5ZYSQ2FGXX2Gmpx0Y+50tB NSGYsUuoUMlheo7GGCH3V5cPzlu/ILikpOU54T/VQ661sc2BxG2YgGPiEjV0FeU3mMJHG0 muuITJurBmjF1qz1/rzWUOHoZJ/4Yi5NxI/zDk/c7MRbsbX9bTmMzTJ7k+ufCQdvbXsXh4 wKYZ0Oy8AVrOESvkgP3SJjOHVXw7AZPmh27qxDfzOj7pI2+G+i1li4vBUY5M4Q== 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 16A792F1BF; Thu, 31 Mar 2022 21:23:02 +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 22VLN1ZZ028890; Thu, 31 Mar 2022 21:23:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22VLN1S2028889; Thu, 31 Mar 2022 21:23:01 GMT (envelope-from git) Date: Thu, 31 Mar 2022 21:23:01 GMT Message-Id: <202203312123.22VLN1S2028889@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: 557dc337e6cb - main - vm_phys: check small blocks to finish allocation 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: 557dc337e6cb6664a322c3988632b5ca75ff33ed Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648761782; 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=b5QeKq3LOuWSkKejkTVytl0N9Z/a1tRZNDkPWGVbqoQ=; b=kl97YNenJSaGFWe5FJ+Qzbd0Tq6ej+6YhbQOLH275JykNvBB8Ne4SrYWnQYQ24d7Y75I4L nN7J2TQI+XPsChmAkR7EnW8F2p1LHEE/z+E+JErXHFNJk7un6LuXQ0AH1kmSMwaXcvbAw0 6jZws7vOdqs9/p4mFnFoBJbXOY3SS9R93eK93CPu41xAjICAGyZhBV0arGegGUtKvuMVAb HD9ox2YeRL0vEjFsyvfIzWPYwtcwRQRlTQ0kQjQI7uEWeAk6xvDk8+h4V1ijpeUrRnK2l5 6IB1BJTDbXt2XQUOpk90eDA+mxRB7k26pmI2XZqhtJNCa58YDtQPUR1lTMLs6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648761782; a=rsa-sha256; cv=none; b=FyUXedELuQd6dr55+pd6L8h8ckiWX0/48RXGSJowtOGVOmb3WHkbupax5xYgvogPvQlEUQ Al853NQjq1j8P2/2cwxP8QTXPbSOI++ivY1Km1Uxp7XVGXd/iPyDnRWqpB8fRPBHx30VJj z1t4Iqh6VCt+gpq98wuyoiAYdN5yOlqNmCUGG4KNXHXj4r5Pf5Elz3ypihFJ4PT+oOnuH8 DuAtN6oBr1OxSKKf7ccyTTqSJ0GzR4Dmo59MBXxXyelRFQBRkK7YrloGSGPxt4qqDUwmnR C5SHLHmsGy7BsLGTevl2F6qm1tPEm3uH4UQT3XLu+YIgyqOxDtVISsWRHNEydw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=557dc337e6cb6664a322c3988632b5ca75ff33ed commit 557dc337e6cb6664a322c3988632b5ca75ff33ed Author: Doug Moore AuthorDate: 2022-03-31 21:19:55 +0000 Commit: Doug Moore CommitDate: 2022-03-31 21:19:55 +0000 vm_phys: check small blocks to finish allocation In vm_phys_alloc_queues_contig, in the case that a sequence of max-order blocks are sought to fulfill an allocation, a sequence is ruled out if it does not have enough max-order blocks to satisfy the allocation. However, there may be smaller blocks of free memory that follow the last max-order block in the sequence, and they may be big enough to complete the allocation request, so check for that possibility before giving up on that block sequence. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D34724 --- sys/vm/vm_phys.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 1f4c228b1a84..33c46fe7c481 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -1405,9 +1405,9 @@ vm_phys_alloc_queues_contig( continue; /* - * Determine if a sufficient number of - * subsequent blocks to satisfy the - * allocation request are free. + * Determine if a series of free oind-blocks + * starting here can satisfy the allocation + * request. */ do { pa += 1 << @@ -1416,6 +1416,23 @@ vm_phys_alloc_queues_contig( goto done; } while (VM_NFREEORDER - 1 == seg->first_page[ atop(pa - seg->start)].order); + + /* + * Determine if an additional series of free + * blocks of diminishing size can help to + * satisfy the allocation request. + */ + for (;;) { + m = &seg->first_page[ + atop(pa - seg->start)]; + if (m->order == VM_NFREEORDER || + pa + (2 << (PAGE_SHIFT + m->order)) + <= pa_end) + break; + pa += 1 << (PAGE_SHIFT + m->order); + if (pa >= pa_end) + goto done; + } } } } @@ -1423,6 +1440,7 @@ vm_phys_alloc_queues_contig( done: for (m = m_ret; m < &m_ret[npages]; m = &m[1 << oind]) { fl = (*queues)[m->pool]; + oind = m->order; vm_freelist_rem(fl, m, oind); if (m->pool != VM_FREEPOOL_DEFAULT) vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind);