diff options
| author | Dan McDonald <danmcd@joyent.com> | 2022-01-31 19:54:55 -0500 |
|---|---|---|
| committer | Dan McDonald <danmcd@joyent.com> | 2022-02-22 10:44:37 -0500 |
| commit | ca783257c986cddcc674ae22916a6766b98a2d36 (patch) | |
| tree | a5ffb2e5714efce67635883089a2b60ec9a7bd2a | |
| parent | 36589d6bb0cdae89e166b57b0d64ae56d53247d9 (diff) | |
| download | illumos-joyent-ca783257c986cddcc674ae22916a6766b98a2d36.tar.gz | |
5513 KM_NORMALPRI should be documented in kmem_alloc(9f) and kmem_cache_create(9f) man pages
14465 Present KM_NOSLEEP_LAZY as documented interface
Reviewed by: Andy Fiddaman <andy@omnios.org>
Approved by: Robert Mustacchi <rm@fingolfin.org>
20 files changed, 77 insertions, 54 deletions
diff --git a/usr/src/common/core/core_shstrtab.c b/usr/src/common/core/core_shstrtab.c index b1bcbce682..ea2d15db40 100644 --- a/usr/src/common/core/core_shstrtab.c +++ b/usr/src/common/core/core_shstrtab.c @@ -46,8 +46,7 @@ static void * shstrtab_alloc(void) { #ifdef _KERNEL - return (kmem_zalloc(sizeof (shstrtab_ent_t), - KM_NOSLEEP | KM_NORMALPRI)); + return (kmem_zalloc(sizeof (shstrtab_ent_t), KM_NOSLEEP_LAZY)); #else return (calloc(1, sizeof (shstrtab_ent_t))); #endif diff --git a/usr/src/man/man9f/kmem_alloc.9f b/usr/src/man/man9f/kmem_alloc.9f index 56c4fb6a2d..5a53bd2451 100644 --- a/usr/src/man/man9f/kmem_alloc.9f +++ b/usr/src/man/man9f/kmem_alloc.9f @@ -1,5 +1,6 @@ '\" te .\" Copyright 2014 Nexenta Systems, Inc. All rights reserved. +.\" Copyright 2022 Joyent, Inc. .\" Copyright 1989 AT&T .\" Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. @@ -46,8 +47,14 @@ Number of bytes to allocate. .ad .RS 8n Determines whether caller can sleep for memory. Possible flags are -\fBKM_SLEEP\fR to allow sleeping until memory is available, or \fBKM_NOSLEEP\fR -to return \fINULL\fR immediately if memory is not available. +\fBKM_SLEEP\fR to allow sleeping until memory is available, \fBKM_NOSLEEP\fR +to return \fINULL\fR if memory is not available even after some reclamation +attempts, and \fBKM_NOSLEEP_LAZY\fR to return \fINULL\fR without reclamation +attempts. \fBKM_NOSLEEP_LAZY\fR is actually two flags combined: +(\fBKM_NOSLEEP\fR | \fBKM_NORMALPRI\fR), the latter flag indicating not to +attempt reclamation before giving up and returning NULL. If any mention of +\fBKM_NOSLEEP\fR appears in this man page by itself, it applies equally to +\fBKM_NOSLEEP_LAZY\fR as well. .RE .sp @@ -65,9 +72,12 @@ returns a pointer to the allocated memory. The allocated memory is at least double-word aligned, so it can hold any C data structure. No greater alignment can be assumed. \fIflag\fR determines whether the caller can sleep for memory. \fBKM_SLEEP\fR allocations may sleep but are guaranteed to succeed. -\fBKM_NOSLEEP\fR allocations are guaranteed not to sleep but may fail (return -\fINULL\fR) if no memory is currently available. The initial contents of memory -allocated using \fBkmem_alloc()\fR are random garbage. +\fBKM_NOSLEEP\fR and \fBKM_NOSLEEP_LAZY\fR allocations are guaranteed not to +sleep but may fail (return \fINULL\fR) if no memory is currently +available. \fBKM_NOSLEEP\fR will first attempt to aggressively reclaim memory +from otherwise unused blocks, while \fBKM_NOSLEEP_LAZY\fR will not attempt any +reclamation. The initial contents of memory allocated using +\fBkmem_alloc()\fR are random garbage. .sp .LP The \fBkmem_zalloc()\fR function is like \fBkmem_alloc()\fR but returns @@ -79,13 +89,14 @@ buffer address and size must exactly match the original allocation. Memory cannot be returned piecemeal. .SH RETURN VALUES If successful, \fBkmem_alloc()\fR and \fBkmem_zalloc()\fR return a pointer to -the allocated memory. If \fBKM_NOSLEEP\fR is set and memory cannot be allocated -without sleeping, \fBkmem_alloc()\fR and \fBkmem_zalloc()\fR return \fINULL\fR. +the allocated memory. If \fBKM_NOSLEEP\fR is set and memory cannot be +allocated without sleeping, \fBkmem_alloc()\fR and \fBkmem_zalloc()\fR return +\fINULL\fR. .SH CONTEXT The \fBkmem_alloc()\fR and \fBkmem_zalloc()\fR functions can be called from -interrupt context only if the \fBKM_NOSLEEP\fR flag is set. They can be called -from user context with any valid \fIflag\fR. The \fBkmem_free()\fR function can -be called from from user, interrupt, or kernel context. +interrupt context only if the \fBKM_NOSLEEP\fR flag is set. They can be +called from user context with any valid \fIflag\fR. The \fBkmem_free()\fR +function can be called from from user, interrupt, or kernel context. .SH SEE ALSO \fBcopyout\fR(9F), \fBfreerbuf\fR(9F), \fBgetrbuf\fR(9F) .sp diff --git a/usr/src/man/man9f/kmem_cache_create.9f b/usr/src/man/man9f/kmem_cache_create.9f index 73e3b67570..e08f120244 100644 --- a/usr/src/man/man9f/kmem_cache_create.9f +++ b/usr/src/man/man9f/kmem_cache_create.9f @@ -1,5 +1,6 @@ '\" te .\" Copyright 2015 Nexenta Systems, Inc. All rights reserved. +.\" Copyright 2022 Joyent, Inc. .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. @@ -169,7 +170,21 @@ Allow sleeping (blocking) until memory is available. \fB\fBKM_NOSLEEP\fR\fR .ad .RS 15n -Return NULL immediately if memory is not available. +Return NULL immediately if memory is not available, but after an aggressive +reclaiming attempt. Any mention of \fBKM_NOSLEEP\fR without mentioning +\fBKM_NOSLEEP_LAZY\fR (see below) applies to both values. +.RE + +.sp +.ne 2 +.na +\fB\fBKM_NOSLEEP_LAZY\fR\fR +.ad +.RS 15n +Return NULL immediately if memory is not available, without the aggressive +reclaiming attempt. This is actually two flags combined: +(\fBKM_NOSLEEP\fR | \fBKM_NORMALPRI\fR), the latter flag indicating not to +attempt reclamation before giving up and returning NULL. .RE .sp @@ -350,8 +365,8 @@ object cache. .LP \fBkmem_cache_alloc()\fR gets an object from the cache. The object will be in its constructed state. \fIkmflag\fR has either \fBKM_SLEEP\fR or -\fBKM_NOSLEEP\fR set, indicating whether it is acceptable to wait for memory if -none is currently available. +\fBKM_NOSLEEP\fR set, indicating whether it is acceptable to wait for memory +if none is currently available. .sp .LP A small pool of reserved memory is available to allow the system to progress @@ -573,8 +588,8 @@ memory. .sp .LP \fBkmem_cache_alloc()\fR can be called from interrupt context only if the -\fBKM_NOSLEEP\fR flag is set. It can be called from user or kernel context with -any valid flag. +\fBKM_NOSLEEP\fR flag is set. It can be called from user or kernel context +with any valid flag. .sp .LP \fBkmem_cache_free()\fR can be called from user, kernel, or interrupt context. @@ -709,9 +724,11 @@ kmem_cache_set_move(object_cache, object_move); .in -2 .SH RETURN VALUES -If successful, the constructor function must return \fB0\fR. If KM_NOSLEEP is -set and memory cannot be allocated without sleeping, the constructor must -return -\fB1\fR. +If successful, the constructor function must return \fB0\fR. If +\fBKM_NOSLEEP\fR or \fBKM_NOSLEEP_LAZY\fR is set and memory cannot be +allocated without sleeping, the constructor must return -\fB1\fR. If the +constructor takes extraordinary steps during a \fBKM_NOSLEEP\fR construction, +it may not take those for a \fBKM_NOSLEEP_LAZY\fR construction. .sp .LP \fBkmem_cache_create()\fR returns a pointer to the allocated cache. diff --git a/usr/src/uts/common/dtrace/dtrace.c b/usr/src/uts/common/dtrace/dtrace.c index 0fd20b7f45..8b7845d37e 100644 --- a/usr/src/uts/common/dtrace/dtrace.c +++ b/usr/src/uts/common/dtrace/dtrace.c @@ -11603,8 +11603,8 @@ dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags, ASSERT(buf->dtb_xamot == NULL); - if ((buf->dtb_tomax = kmem_zalloc(size, - KM_NOSLEEP | KM_NORMALPRI)) == NULL) + if ((buf->dtb_tomax = kmem_zalloc(size, KM_NOSLEEP_LAZY)) == + NULL) goto err; buf->dtb_size = size; @@ -11615,8 +11615,8 @@ dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags, if (flags & DTRACEBUF_NOSWITCH) continue; - if ((buf->dtb_xamot = kmem_zalloc(size, - KM_NOSLEEP | KM_NORMALPRI)) == NULL) + if ((buf->dtb_xamot = kmem_zalloc(size, KM_NOSLEEP_LAZY)) == + NULL) goto err; } while ((cp = cp->cpu_next) != cpu_list); @@ -13564,7 +13564,7 @@ dtrace_dstate_init(dtrace_dstate_t *dstate, size_t size) if (size < (min = dstate->dtds_chunksize + sizeof (dtrace_dynhash_t))) size = min; - if ((base = kmem_zalloc(size, KM_NOSLEEP | KM_NORMALPRI)) == NULL) + if ((base = kmem_zalloc(size, KM_NOSLEEP_LAZY)) == NULL) return (ENOMEM); dstate->dtds_size = size; @@ -14091,7 +14091,7 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) } spec = kmem_zalloc(nspec * sizeof (dtrace_speculation_t), - KM_NOSLEEP | KM_NORMALPRI); + KM_NOSLEEP_LAZY); if (spec == NULL) { rval = ENOMEM; @@ -14102,8 +14102,7 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) state->dts_nspeculations = (int)nspec; for (i = 0; i < nspec; i++) { - if ((buf = kmem_zalloc(bufsize, - KM_NOSLEEP | KM_NORMALPRI)) == NULL) { + if ((buf = kmem_zalloc(bufsize, KM_NOSLEEP_LAZY)) == NULL) { rval = ENOMEM; goto err; } diff --git a/usr/src/uts/common/fs/bootfs/bootfs_vfsops.c b/usr/src/uts/common/fs/bootfs/bootfs_vfsops.c index e642e86169..5b3171e0d1 100644 --- a/usr/src/uts/common/fs/bootfs/bootfs_vfsops.c +++ b/usr/src/uts/common/fs/bootfs/bootfs_vfsops.c @@ -93,7 +93,7 @@ bootfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr) * there's nothing to be done about that. */ vfs_setresource(vfsp, bootfs_name, 0); - bfs = kmem_zalloc(sizeof (bootfs_t), KM_NOSLEEP | KM_NORMALPRI); + bfs = kmem_zalloc(sizeof (bootfs_t), KM_NOSLEEP_LAZY); if (bfs == NULL) return (ENOMEM); diff --git a/usr/src/uts/common/fs/nfs/nfs_auth.c b/usr/src/uts/common/fs/nfs/nfs_auth.c index e132346545..c20a18f433 100644 --- a/usr/src/uts/common/fs/nfs/nfs_auth.c +++ b/usr/src/uts/common/fs/nfs/nfs_auth.c @@ -922,7 +922,7 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor, rw_exit(&exi->exi_cache_lock); - nc = kmem_alloc(sizeof (*nc), KM_NOSLEEP | KM_NORMALPRI); + nc = kmem_alloc(sizeof (*nc), KM_NOSLEEP_LAZY); if (nc == NULL) goto retrieve; @@ -930,8 +930,7 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor, * Initialize the new auth_cache_clnt */ nc->authc_addr = addr; - nc->authc_addr.buf = kmem_alloc(addr.maxlen, - KM_NOSLEEP | KM_NORMALPRI); + nc->authc_addr.buf = kmem_alloc(addr.maxlen, KM_NOSLEEP_LAZY); if (addr.maxlen != 0 && nc->authc_addr.buf == NULL) { kmem_free(nc, sizeof (*nc)); goto retrieve; @@ -972,8 +971,7 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor, rw_exit(&c->authc_lock); - np = kmem_cache_alloc(exi_cache_handle, - KM_NOSLEEP | KM_NORMALPRI); + np = kmem_cache_alloc(exi_cache_handle, KM_NOSLEEP_LAZY); if (np == NULL) { rw_exit(&exi->exi_cache_lock); goto retrieve; @@ -1071,7 +1069,7 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor, * auth_cache entry */ tmpgids = kmem_alloc(tmpngids * sizeof (gid_t), - KM_NOSLEEP | KM_NORMALPRI); + KM_NOSLEEP_LAZY); if (tmpgids != NULL) bcopy(*gids, tmpgids, tmpngids * sizeof (gid_t)); diff --git a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_copychunk.c b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_copychunk.c index 4a657bbf19..930bd353c4 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_copychunk.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_copychunk.c @@ -204,7 +204,7 @@ smb2_fsctl_copychunk(smb_request_t *sr, smb_fsctl_t *fsctl) * The client should then fall back to normal copy. */ args->bufsize = smb2_copychunk_max_seg; - args->buffer = kmem_alloc(args->bufsize, KM_NOSLEEP | KM_NORMALPRI); + args->buffer = kmem_alloc(args->bufsize, KM_NOSLEEP_LAZY); if (args->buffer == NULL) { status = NT_STATUS_INSUFF_SERVER_RESOURCES; goto out; diff --git a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c index 0452cddb39..fe748bbd62 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c @@ -667,7 +667,7 @@ smb2_fsctl_odx_write_native1(smb_request_t *sr, * allow the allocation to fail and return an error. * The client should then fall back to normal copy. */ - buffer = kmem_alloc(bufsize, KM_NOSLEEP | KM_NORMALPRI); + buffer = kmem_alloc(bufsize, KM_NOSLEEP_LAZY); if (buffer == NULL) { status = NT_STATUS_INSUFF_SERVER_RESOURCES; goto out; diff --git a/usr/src/uts/common/fs/zfs/zcp.c b/usr/src/uts/common/fs/zfs/zcp.c index 61ce60a233..45ffa37e2a 100644 --- a/usr/src/uts/common/fs/zfs/zcp.c +++ b/usr/src/uts/common/fs/zfs/zcp.c @@ -718,8 +718,7 @@ static void * zcp_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) { zcp_alloc_arg_t *allocargs = ud; - int flags = (allocargs->aa_must_succeed) ? - KM_SLEEP : (KM_NOSLEEP | KM_NORMALPRI); + int flags = (allocargs->aa_must_succeed) ? KM_SLEEP : KM_NOSLEEP_LAZY; if (nsize == 0) { if (ptr != NULL) { diff --git a/usr/src/uts/common/inet/ip/ip_attr.c b/usr/src/uts/common/inet/ip/ip_attr.c index 6dfbc53d77..0aa969d971 100644 --- a/usr/src/uts/common/inet/ip/ip_attr.c +++ b/usr/src/uts/common/inet/ip/ip_attr.c @@ -862,7 +862,7 @@ conn_get_ixa_exclusive(conn_t *connp) ip_xmit_attr_t *oldixa; ip_xmit_attr_t *ixa; - ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP | KM_NORMALPRI); + ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP_LAZY); if (ixa == NULL) return (NULL); diff --git a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c index 4ab032e354..d39f1954b1 100644 --- a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c +++ b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c @@ -2389,7 +2389,7 @@ sbd_write_same_data(struct scsi_task *task, sbd_cmd_t *scmd) * Don't sleep for the allocation, and don't make the system * reclaim memory. Trade higher I/Os if in a low-memory situation. */ - big_buf = kmem_alloc(big_buf_size, KM_NOSLEEP | KM_NORMALPRI); + big_buf = kmem_alloc(big_buf_size, KM_NOSLEEP_LAZY); if (big_buf == NULL) { /* diff --git a/usr/src/uts/common/io/mac/mac_protect.c b/usr/src/uts/common/io/mac/mac_protect.c index da83dc643e..17959ac48d 100644 --- a/usr/src/uts/common/io/mac/mac_protect.c +++ b/usr/src/uts/common/io/mac/mac_protect.c @@ -1469,8 +1469,8 @@ insert_slaac_prefix(mac_client_impl_t *mcip, nd_opt_prefix_info_t *po) return; } - if ((addr = kmem_zalloc(sizeof (slaac_addr_t), - KM_NOSLEEP | KM_NORMALPRI)) == NULL) + if ((addr = kmem_zalloc(sizeof (slaac_addr_t), KM_NOSLEEP_LAZY)) == + NULL) return; bcopy(&po->nd_opt_pi_prefix, &addr->sla_prefix, diff --git a/usr/src/uts/common/io/overlay/overlay_target.c b/usr/src/uts/common/io/overlay/overlay_target.c index cb1366708a..3f2167620a 100644 --- a/usr/src/uts/common/io/overlay/overlay_target.c +++ b/usr/src/uts/common/io/overlay/overlay_target.c @@ -354,8 +354,7 @@ overlay_target_lookup(overlay_dev_t *odd, mblk_t *mp, struct sockaddr *sock, entry = refhash_lookup(ott->ott_u.ott_dyn.ott_dhash, mhi.mhi_daddr); if (entry == NULL) { - entry = kmem_cache_alloc(overlay_entry_cache, - KM_NOSLEEP | KM_NORMALPRI); + entry = kmem_cache_alloc(overlay_entry_cache, KM_NOSLEEP_LAZY); if (entry == NULL) { mutex_exit(&ott->ott_lock); return (OVERLAY_TARGET_DROP); diff --git a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c index 691c03bff4..e3b6d2fa8d 100644 --- a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c +++ b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c @@ -10766,7 +10766,7 @@ ahci_em_ioctl_set(ahci_ctl_t *ahci_ctlp, intptr_t arg) return (ENOTSUP); } - task = kmem_alloc(sizeof (*task), KM_NOSLEEP | KM_NORMALPRI); + task = kmem_alloc(sizeof (*task), KM_NOSLEEP_LAZY); if (task == NULL) { return (ENOMEM); } diff --git a/usr/src/uts/common/io/ufmtest.c b/usr/src/uts/common/io/ufmtest.c index 25c4af8fee..241d71d5c5 100644 --- a/usr/src/uts/common/io/ufmtest.c +++ b/usr/src/uts/common/io/ufmtest.c @@ -256,7 +256,7 @@ ufmtest_do_setfw(intptr_t data, int mode) ufmt.ufmt_nvl = NULL; } - nvlbuf = kmem_zalloc(setfw.utsw_bufsz, KM_NOSLEEP | KM_NORMALPRI); + nvlbuf = kmem_zalloc(setfw.utsw_bufsz, KM_NOSLEEP_LAZY); if (nvlbuf == NULL) return (ENOMEM); diff --git a/usr/src/uts/common/io/usb/clients/ccid/ccid.c b/usr/src/uts/common/io/usb/clients/ccid/ccid.c index 9631a99283..60574f8aa1 100644 --- a/usr/src/uts/common/io/usb/clients/ccid/ccid.c +++ b/usr/src/uts/common/io/usb/clients/ccid/ccid.c @@ -1636,7 +1636,7 @@ ccid_command_alloc(ccid_t *ccid, ccid_slot_t *slot, boolean_t block, kmflag = KM_SLEEP; usbflag = USB_FLAGS_SLEEP; } else { - kmflag = KM_NOSLEEP | KM_NORMALPRI; + kmflag = KM_NOSLEEP_LAZY; usbflag = 0; } diff --git a/usr/src/uts/common/os/ddi_ufm.c b/usr/src/uts/common/os/ddi_ufm.c index 7e863bdac2..3610df8bac 100644 --- a/usr/src/uts/common/os/ddi_ufm.c +++ b/usr/src/uts/common/os/ddi_ufm.c @@ -181,7 +181,7 @@ ufm_cache_fill(ddi_ufm_handle_t *ufmh) */ ufmh->ufmh_images = kmem_zalloc((sizeof (ddi_ufm_image_t) * ufmh->ufmh_nimages), - KM_NOSLEEP | KM_NORMALPRI); + KM_NOSLEEP_LAZY); if (ufmh->ufmh_images == NULL) return (ENOMEM); @@ -201,7 +201,7 @@ ufm_cache_fill(ddi_ufm_handle_t *ufmh) img->ufmi_slots = kmem_zalloc((sizeof (ddi_ufm_slot_t) * img->ufmi_nslots), - KM_NOSLEEP | KM_NORMALPRI); + KM_NOSLEEP_LAZY); if (img->ufmi_slots == NULL) { ret = ENOMEM; goto cache_fail; diff --git a/usr/src/uts/common/os/vm_pageout.c b/usr/src/uts/common/os/vm_pageout.c index 9b740c16ef..c3fd3658d6 100644 --- a/usr/src/uts/common/os/vm_pageout.c +++ b/usr/src/uts/common/os/vm_pageout.c @@ -133,7 +133,7 @@ * v allocations (e.g., KM_SLEEP) are held here while we wait for * | more memory. Non-sleeping allocations are generally allowed to * | proceed, unless their priority is explicitly lowered with - * | KM_NORMALPRI. + * | KM_NORMALPRI (Note: KM_NOSLEEP_LAZY == (KM_NOSLEEP | KM_NORMALPRI).). * | * +------- pageout_reserve (3/4 of throttlefree, 0.44% of physmem, min. 4MB) * | diff --git a/usr/src/uts/common/sys/kmem.h b/usr/src/uts/common/sys/kmem.h index aac2eafa3c..bfc301a521 100644 --- a/usr/src/uts/common/sys/kmem.h +++ b/usr/src/uts/common/sys/kmem.h @@ -23,7 +23,7 @@ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. - * Copyright 2018, Joyent, Inc. + * Copyright 2022 Joyent, Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -49,6 +49,7 @@ extern "C" { #define KM_PANIC 0x0002 /* if memory cannot be allocated, panic */ #define KM_PUSHPAGE 0x0004 /* can block for memory; may use reserve */ #define KM_NORMALPRI 0x0008 /* with KM_NOSLEEP, lower priority allocation */ +#define KM_NOSLEEP_LAZY (KM_NOSLEEP | KM_NORMALPRI) /* Syntactic sugar. */ #define KM_VMFLAGS 0x00ff /* flags that must match VM_* flags */ #define KM_FLAGS 0xffff /* all settable kmem flags */ diff --git a/usr/src/uts/intel/io/imc/imc.c b/usr/src/uts/intel/io/imc/imc.c index e1dbfbfc2e..67a14528f0 100644 --- a/usr/src/uts/intel/io/imc/imc.c +++ b/usr/src/uts/intel/io/imc/imc.c @@ -1405,7 +1405,7 @@ imc_nvl_pack(imc_socket_t *sock, boolean_t sleep) if (sleep) { kmflag = KM_SLEEP; } else { - kmflag = KM_NOSLEEP | KM_NORMALPRI; + kmflag = KM_NOSLEEP_LAZY; } if (nvlist_pack(sock->isock_nvl, &buf, &len, NV_ENCODE_XDR, @@ -1432,7 +1432,7 @@ imc_decoder_pack(imc_t *imc) } if (nvlist_pack(imc->imc_decoder_dump, &buf, &len, NV_ENCODE_XDR, - KM_NOSLEEP | KM_NORMALPRI) != 0) { + KM_NOSLEEP_LAZY) != 0) { return; } |
