Print this page
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
Change-Id: I002ec28ddf390650f1fcba1ca94f6abfdb241439


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2012 by Delphix. All rights reserved.
  25  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  26  * Copyright 2018, Joyent, Inc.
  27  */
  28 
  29 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  30 /*        All Rights Reserved   */
  31 
  32 #ifndef _SYS_KMEM_H
  33 #define _SYS_KMEM_H
  34 
  35 #include <sys/types.h>
  36 #include <sys/vmem.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * Kernel memory allocator: DDI interfaces.
  44  * See kmem_alloc(9F) for details.
  45  */
  46 
  47 #define KM_SLEEP        0x0000  /* can block for memory; success guaranteed */
  48 #define KM_NOSLEEP      0x0001  /* cannot block for memory; may fail */
  49 #define KM_PANIC        0x0002  /* if memory cannot be allocated, panic */
  50 #define KM_PUSHPAGE     0x0004  /* can block for memory; may use reserve */
  51 #define KM_NORMALPRI    0x0008  /* with KM_NOSLEEP, lower priority allocation */

  52 #define KM_VMFLAGS      0x00ff  /* flags that must match VM_* flags */
  53 
  54 #define KM_FLAGS        0xffff  /* all settable kmem flags */
  55 
  56 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
  57 
  58 extern void *kmem_alloc(size_t size, int kmflags);
  59 extern void *kmem_zalloc(size_t size, int kmflags);
  60 extern void kmem_free(void *buf, size_t size);
  61 extern void *kmem_alloc_tryhard(size_t size, size_t *alloc_size, int kmflags);
  62 extern void kmem_dump_init(size_t);
  63 extern void kmem_dump_begin(void);
  64 extern size_t kmem_dump_finish(char *buf, size_t size);
  65 
  66 #endif  /* _KERNEL */
  67 
  68 /*
  69  * Kernel memory allocator: private interfaces.
  70  * These interfaces are still evolving.
  71  * Do not use them in unbundled drivers.




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2012 by Delphix. All rights reserved.
  25  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  26  * Copyright 2022 Joyent, Inc.
  27  */
  28 
  29 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  30 /*        All Rights Reserved   */
  31 
  32 #ifndef _SYS_KMEM_H
  33 #define _SYS_KMEM_H
  34 
  35 #include <sys/types.h>
  36 #include <sys/vmem.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * Kernel memory allocator: DDI interfaces.
  44  * See kmem_alloc(9F) for details.
  45  */
  46 
  47 #define KM_SLEEP        0x0000  /* can block for memory; success guaranteed */
  48 #define KM_NOSLEEP      0x0001  /* cannot block for memory; may fail */
  49 #define KM_PANIC        0x0002  /* if memory cannot be allocated, panic */
  50 #define KM_PUSHPAGE     0x0004  /* can block for memory; may use reserve */
  51 #define KM_NORMALPRI    0x0008  /* with KM_NOSLEEP, lower priority allocation */
  52 #define KM_NOSLEEP_LAZY (KM_NOSLEEP | KM_NORMALPRI)  /* Syntactic sugar. */
  53 #define KM_VMFLAGS      0x00ff  /* flags that must match VM_* flags */
  54 
  55 #define KM_FLAGS        0xffff  /* all settable kmem flags */
  56 
  57 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
  58 
  59 extern void *kmem_alloc(size_t size, int kmflags);
  60 extern void *kmem_zalloc(size_t size, int kmflags);
  61 extern void kmem_free(void *buf, size_t size);
  62 extern void *kmem_alloc_tryhard(size_t size, size_t *alloc_size, int kmflags);
  63 extern void kmem_dump_init(size_t);
  64 extern void kmem_dump_begin(void);
  65 extern size_t kmem_dump_finish(char *buf, size_t size);
  66 
  67 #endif  /* _KERNEL */
  68 
  69 /*
  70  * Kernel memory allocator: private interfaces.
  71  * These interfaces are still evolving.
  72  * Do not use them in unbundled drivers.