From nobody Fri Jun 14 01:21:16 2024 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 4W0hLj69Dwz5N2nL; Fri, 14 Jun 2024 01:21:17 +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 4W0hLj0wPhz4VV0; Fri, 14 Jun 2024 01:21:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718328077; 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=yvntLzBnE5ANynjvuPP4z1JWBn8WoWn+EwJPNTVzD/M=; b=VqNEZ5rokGWOd1ZFgSJ9Jgb/EDLJtiiI1fHtivZOTizxOQ7PF7HSOczfO+TI0FD3QElGfY UqXKMy4xu3SP3zXjw9Ut91G+P7N6bbqRifJRWthj3LsvAhOh5b5w1ANAfDkZ/H8+mHaakn KYOzAFEiATqs8gfdg4Ayrq29y3B6rAEuI1jFJbEZOBXj1VfZZmmVPNNCl1YR2XBGEp8jXt Q7b8QGhEEWkYW2tl3f4TJ1ZT5asNZPh+g8vfgLtyIFy0IpMBV6vr9fJQu633WjOlJzIkOf X92f9E/gXc/KrJsySDbFpL/XtjPV40BjGYbwOAoj0S32yScDZeUN/I5cv4cJsw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718328077; a=rsa-sha256; cv=none; b=sflXfj/HhAxWVKFPmwQcR663PA9iiMED4hyyo6msNiDJUFW4w07iXlBVxArdE7i8H42/2d 8cpW6RPm1sJBcH14l0N1YI8HQeChG2mm/b272GI1G5FCMJW1G/eIMrV/0sOhokhn+PpTi3 7OxXhqkvOnW1pjOF4nL3T8yWSzfpDXTDR2hBNmQMkdF+b1XsW69VWdmTBUWYHY+aNJpoOo VX59Tkx6JhvOLTRyIsjLGmWle/gSkOqshFFeeeLy1OxFRhbOlsA2YuqsrhhPRdxiVor07u K22DRjjYnSzuG5o1CzTSiC4nZlJ4s/6GMghsUjFxJeuINRRyoFo8h50u2lvrkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718328077; 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=yvntLzBnE5ANynjvuPP4z1JWBn8WoWn+EwJPNTVzD/M=; b=YOufWXnb0pVxQuZTlKfq4yFYmn2pflBRrk/x2WteNmwz6o1nlUxw8KmwawKQ7vT4GC7viQ EgwIKanAzOidBQ693VqZJ8lV/5FHaFs5rWw8Ryn9tu/GNdrE9zfPJjJuG6KYiBa0utf821 gHsv4eQeArsp7WYKUAFWT2ZZdPr17e5lgDgSZ30/tAG90qrVPX3CMf4IC0107Wxr8mc++Y blJAif9soDvWfBo1TIDKISmL1h5jVKAJSdq51cwmsj7GgIYRr6y6jmiPCnS0d2xaOxJHqy F5en3kIfzsEtdZH0GlhxixNL8+W9twYbJw+A59mUnj5/jHcP+xub0mPXNncF2A== 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 4W0hLj0KD9z10vf; Fri, 14 Jun 2024 01:21:17 +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 45E1LGfU054716; Fri, 14 Jun 2024 01:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45E1LGmD054713; Fri, 14 Jun 2024 01:21:16 GMT (envelope-from git) Date: Fri, 14 Jun 2024 01:21:16 GMT Message-Id: <202406140121.45E1LGmD054713@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: d7ec4a8859b4 - main - vm_phys: Factor out some calls to vm_freelist_add() 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: d7ec4a8859b44beb9ef69620134ba5c5ce4d598c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d7ec4a8859b44beb9ef69620134ba5c5ce4d598c commit d7ec4a8859b44beb9ef69620134ba5c5ce4d598c Author: Mark Johnston AuthorDate: 2024-06-14 00:11:15 +0000 Commit: Mark Johnston CommitDate: 2024-06-14 01:18:59 +0000 vm_phys: Factor out some calls to vm_freelist_add() A subsequent patch will make this factoring more worthwhile. No functional change intended. Reviewed by: dougm, alc, kib, emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D40400 --- sys/vm/vm_phys.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 62e84a5b52bd..6323fb484030 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -680,6 +680,15 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order, } } +static void +vm_phys_enq_chunk(struct vm_freelist *fl, vm_page_t m, int order, int tail) +{ + KASSERT(order >= 0 && order < VM_NFREEORDER, + ("%s: invalid order %d", __func__, order)); + + vm_freelist_add(fl, m, order, tail); +} + /* * Add the physical pages [m, m + npages) at the beginning of a power-of-two * aligned and sized set to the specified free list. @@ -706,13 +715,13 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) KASSERT(m->order == VM_NFREEORDER, ("%s: page %p has unexpected order %d", __func__, m, m->order)); - order = ilog2(npages); + order = ilog2(npages); KASSERT(order < VM_NFREEORDER, ("%s: order %d is out of range", __func__, order)); - vm_freelist_add(fl, m, order, tail); + vm_phys_enq_chunk(fl, m, order, tail); m += 1 << order; - npages -= 1 << order; - } + npages -= 1 << order; + } } /* @@ -743,9 +752,7 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail) ("vm_phys_enq_range: page %p has unexpected order %d", m, m->order)); order = ffs(npages) - 1; - KASSERT(order < VM_NFREEORDER, - ("vm_phys_enq_range: order %d is out of range", order)); - vm_freelist_add(fl, m, order, tail); + vm_phys_enq_chunk(fl, m, order, tail); m += 1 << order; npages -= 1 << order; } @@ -1203,7 +1210,7 @@ vm_phys_enqueue_contig(vm_page_t m, u_long npages) KASSERT(seg == &vm_phys_segs[m->segind], ("%s: page range [%p,%p) spans multiple segments", __func__, m_end - npages, m)); - vm_freelist_add(fl, m, order, 1); + vm_phys_enq_chunk(fl, m, order, 1); m += 1 << order; } /* Free blocks of diminishing size. */