svn commit: r351351 - head/sys/kern
Mark Johnston
markj at FreeBSD.org
Wed Aug 21 20:01:53 UTC 2019
Author: markj
Date: Wed Aug 21 20:01:52 2019
New Revision: 351351
URL: https://svnweb.freebsd.org/changeset/base/351351
Log:
Remove manual wire_count adjustments from the unmapped mbuf code.
The original code came from a desire to minimize the number of updates
to v_wire_count, which prior to r329187 was updated using atomics.
However, there is no significant benefit to batching today, so simply
allocate pages using VM_ALLOC_WIRED and rely on system accounting.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D21323
Modified:
head/sys/kern/uipc_mbuf.c
Modified: head/sys/kern/uipc_mbuf.c
==============================================================================
--- head/sys/kern/uipc_mbuf.c Wed Aug 21 19:57:54 2019 (r351350)
+++ head/sys/kern/uipc_mbuf.c Wed Aug 21 20:01:52 2019 (r351351)
@@ -1616,22 +1616,18 @@ mb_free_mext_pgs(struct mbuf *m)
{
struct mbuf_ext_pgs *ext_pgs;
vm_page_t pg;
- int wire_adj;
MBUF_EXT_PGS_ASSERT(m);
ext_pgs = m->m_ext.ext_pgs;
- wire_adj = 0;
for (int i = 0; i < ext_pgs->npgs; i++) {
pg = PHYS_TO_VM_PAGE(ext_pgs->pa[i]);
/*
* Note: page is not locked, as it has no
* object and is not on any queues.
*/
- vm_page_free_toq(pg);
- wire_adj++;
+ vm_page_unwire_noq(pg);
+ vm_page_free(pg);
}
- if (wire_adj)
- vm_wire_sub(wire_adj);
}
static struct mbuf *
@@ -1640,9 +1636,10 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i
struct mbuf *m, *mb, *prev;
struct mbuf_ext_pgs *pgs;
vm_page_t pg_array[MBUF_PEXT_MAX_PGS];
- int error, length, i, needed, wire_adj = 0;
+ int error, length, i, needed;
ssize_t total;
- int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP;
+ int pflags = malloc2vm_flags(how) | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP |
+ VM_ALLOC_WIRED;
/*
* len can be zero or an arbitrary large value bound by
@@ -1676,9 +1673,6 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i
retry_page:
pg_array[i] = vm_page_alloc(NULL, 0, pflags);
if (pg_array[i] == NULL) {
- if (wire_adj)
- vm_wire_add(wire_adj);
- wire_adj = 0;
if (how & M_NOWAIT) {
goto failed;
} else {
@@ -1686,15 +1680,12 @@ retry_page:
goto retry_page;
}
}
- wire_adj++;
pg_array[i]->flags &= ~PG_ZERO;
pgs->pa[i] = VM_PAGE_TO_PHYS(pg_array[i]);
pgs->npgs++;
}
pgs->last_pg_len = length - PAGE_SIZE * (pgs->npgs - 1);
MBUF_EXT_PGS_ASSERT_SANITY(pgs);
- vm_wire_add(wire_adj);
- wire_adj = 0;
total -= length;
error = uiomove_fromphys(pg_array, 0, length, uio);
if (error != 0)
More information about the svn-src-all
mailing list