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
This commit is contained in:
parent
65174f684c
commit
9fb7c918ef
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351351
@ -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, int maxseg, int flags)
|
||||
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, int maxseg, int flags)
|
||||
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 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, int maxseg, int flags)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user