Print this page
9525 kmem_dump_size is a corrupting influence


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   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) 1994, 2010, Oracle and/or its affiliates. All rights reserved.

  24  */
  25 
  26 #ifndef _SYS_KMEM_IMPL_H
  27 #define _SYS_KMEM_IMPL_H
  28 
  29 #include <sys/kmem.h>
  30 #include <sys/vmem.h>
  31 #include <sys/thread.h>
  32 #include <sys/t_lock.h>
  33 #include <sys/time.h>
  34 #include <sys/kstat.h>
  35 #include <sys/cpuvar.h>
  36 #include <sys/systm.h>
  37 #include <vm/page.h>
  38 #include <sys/avl.h>
  39 #include <sys/list.h>
  40 
  41 #ifdef  __cplusplus
  42 extern "C" {
  43 #endif


 311          */
 312         avl_tree_t      kmd_moves_pending;      /* buffer moves pending */
 313         list_t          kmd_deadlist;           /* deferred slab frees */
 314         size_t          kmd_deadcount;          /* # of slabs in kmd_deadlist */
 315         uint8_t         kmd_reclaim_numer;      /* slab usage threshold */
 316         uint8_t         kmd_pad1;               /* compiler padding */
 317         uint16_t        kmd_consolidate;        /* triggers consolidator */
 318         uint32_t        kmd_pad2;               /* compiler padding */
 319         size_t          kmd_slabs_sought;       /* reclaimable slabs sought */
 320         size_t          kmd_slabs_found;        /* reclaimable slabs found */
 321         size_t          kmd_tries;              /* nth scan interval counter */
 322         /*
 323          * Fields used to ASSERT that the client does not kmem_cache_free()
 324          * objects passed to the move callback.
 325          */
 326         void            *kmd_from_buf;          /* object to move */
 327         void            *kmd_to_buf;            /* move destination */
 328         kthread_t       *kmd_thread;            /* thread calling move */
 329 } kmem_defrag_t;
 330 






 331 #define KMEM_CACHE_NAMELEN      31
 332 
 333 struct kmem_cache {
 334         /*
 335          * Statistics
 336          */
 337         uint64_t        cache_slab_create;      /* slab creates */
 338         uint64_t        cache_slab_destroy;     /* slab destroys */
 339         uint64_t        cache_slab_alloc;       /* slab layer allocations */
 340         uint64_t        cache_slab_free;        /* slab layer frees */
 341         uint64_t        cache_alloc_fail;       /* total failed allocations */
 342         uint64_t        cache_buftotal;         /* total buffers */
 343         uint64_t        cache_bufmax;           /* max buffers ever */
 344         uint64_t        cache_bufslab;          /* buffers free in slab layer */
 345         uint64_t        cache_reap;             /* cache reaps */
 346         uint64_t        cache_rescale;          /* hash table rescales */
 347         uint64_t        cache_lookup_depth;     /* hash lookup depth */
 348         uint64_t        cache_depot_contention; /* mutex contention count */
 349         uint64_t        cache_depot_contention_prev; /* previous snapshot */
 350 


 381         size_t          cache_color;            /* next slab color */
 382         size_t          cache_mincolor;         /* maximum slab color */
 383         size_t          cache_maxcolor;         /* maximum slab color */
 384         size_t          cache_hash_shift;       /* get to interesting bits */
 385         size_t          cache_hash_mask;        /* hash table mask */
 386         list_t          cache_complete_slabs;   /* completely allocated slabs */
 387         size_t          cache_complete_slab_count;
 388         avl_tree_t      cache_partial_slabs;    /* partial slab freelist */
 389         size_t          cache_partial_binshift; /* for AVL sort bins */
 390         kmem_cache_t    *cache_bufctl_cache;    /* source of bufctls */
 391         kmem_bufctl_t   **cache_hash_table;     /* hash table base */
 392         kmem_defrag_t   *cache_defrag;          /* slab consolidator fields */
 393 
 394         /*
 395          * Depot layer
 396          */
 397         kmutex_t        cache_depot_lock;       /* protects depot */
 398         kmem_magtype_t  *cache_magtype;         /* magazine type */
 399         kmem_maglist_t  cache_full;             /* full magazines */
 400         kmem_maglist_t  cache_empty;            /* empty magazines */
 401         void            *cache_dumpfreelist;    /* heap during crash dump */
 402         void            *cache_dumplog;         /* log entry during dump */
 403 
 404         /*
 405          * Per-CPU layer
 406          */
 407         kmem_cpu_cache_t cache_cpu[1];          /* max_ncpus actual elements */
 408 };
 409 
 410 typedef struct kmem_cpu_log_header {
 411         kmutex_t        clh_lock;
 412         char            *clh_current;
 413         size_t          clh_avail;
 414         int             clh_chunk;
 415         int             clh_hits;
 416         char            clh_pad[64 - sizeof (kmutex_t) - sizeof (char *) -
 417                                 sizeof (size_t) - 2 * sizeof (int)];
 418 } kmem_cpu_log_header_t;
 419 
 420 typedef struct kmem_log_header {
 421         kmutex_t        lh_lock;
 422         char            *lh_base;




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   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) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2018 Joyent, Inc.
  25  */
  26 
  27 #ifndef _SYS_KMEM_IMPL_H
  28 #define _SYS_KMEM_IMPL_H
  29 
  30 #include <sys/kmem.h>
  31 #include <sys/vmem.h>
  32 #include <sys/thread.h>
  33 #include <sys/t_lock.h>
  34 #include <sys/time.h>
  35 #include <sys/kstat.h>
  36 #include <sys/cpuvar.h>
  37 #include <sys/systm.h>
  38 #include <vm/page.h>
  39 #include <sys/avl.h>
  40 #include <sys/list.h>
  41 
  42 #ifdef  __cplusplus
  43 extern "C" {
  44 #endif


 312          */
 313         avl_tree_t      kmd_moves_pending;      /* buffer moves pending */
 314         list_t          kmd_deadlist;           /* deferred slab frees */
 315         size_t          kmd_deadcount;          /* # of slabs in kmd_deadlist */
 316         uint8_t         kmd_reclaim_numer;      /* slab usage threshold */
 317         uint8_t         kmd_pad1;               /* compiler padding */
 318         uint16_t        kmd_consolidate;        /* triggers consolidator */
 319         uint32_t        kmd_pad2;               /* compiler padding */
 320         size_t          kmd_slabs_sought;       /* reclaimable slabs sought */
 321         size_t          kmd_slabs_found;        /* reclaimable slabs found */
 322         size_t          kmd_tries;              /* nth scan interval counter */
 323         /*
 324          * Fields used to ASSERT that the client does not kmem_cache_free()
 325          * objects passed to the move callback.
 326          */
 327         void            *kmd_from_buf;          /* object to move */
 328         void            *kmd_to_buf;            /* move destination */
 329         kthread_t       *kmd_thread;            /* thread calling move */
 330 } kmem_defrag_t;
 331 
 332 typedef struct kmem_dump {
 333         void            *kd_freelist;           /* heap during crash dump */
 334         uint_t          kd_alloc_fails;         /* # of allocation failures */
 335         uint_t          kd_unsafe;              /* cache was used, but unsafe */
 336 } kmem_dump_t;
 337 
 338 #define KMEM_CACHE_NAMELEN      31
 339 
 340 struct kmem_cache {
 341         /*
 342          * Statistics
 343          */
 344         uint64_t        cache_slab_create;      /* slab creates */
 345         uint64_t        cache_slab_destroy;     /* slab destroys */
 346         uint64_t        cache_slab_alloc;       /* slab layer allocations */
 347         uint64_t        cache_slab_free;        /* slab layer frees */
 348         uint64_t        cache_alloc_fail;       /* total failed allocations */
 349         uint64_t        cache_buftotal;         /* total buffers */
 350         uint64_t        cache_bufmax;           /* max buffers ever */
 351         uint64_t        cache_bufslab;          /* buffers free in slab layer */
 352         uint64_t        cache_reap;             /* cache reaps */
 353         uint64_t        cache_rescale;          /* hash table rescales */
 354         uint64_t        cache_lookup_depth;     /* hash lookup depth */
 355         uint64_t        cache_depot_contention; /* mutex contention count */
 356         uint64_t        cache_depot_contention_prev; /* previous snapshot */
 357 


 388         size_t          cache_color;            /* next slab color */
 389         size_t          cache_mincolor;         /* maximum slab color */
 390         size_t          cache_maxcolor;         /* maximum slab color */
 391         size_t          cache_hash_shift;       /* get to interesting bits */
 392         size_t          cache_hash_mask;        /* hash table mask */
 393         list_t          cache_complete_slabs;   /* completely allocated slabs */
 394         size_t          cache_complete_slab_count;
 395         avl_tree_t      cache_partial_slabs;    /* partial slab freelist */
 396         size_t          cache_partial_binshift; /* for AVL sort bins */
 397         kmem_cache_t    *cache_bufctl_cache;    /* source of bufctls */
 398         kmem_bufctl_t   **cache_hash_table;     /* hash table base */
 399         kmem_defrag_t   *cache_defrag;          /* slab consolidator fields */
 400 
 401         /*
 402          * Depot layer
 403          */
 404         kmutex_t        cache_depot_lock;       /* protects depot */
 405         kmem_magtype_t  *cache_magtype;         /* magazine type */
 406         kmem_maglist_t  cache_full;             /* full magazines */
 407         kmem_maglist_t  cache_empty;            /* empty magazines */
 408         kmem_dump_t     cache_dump;             /* used during crash dump */

 409 
 410         /*
 411          * Per-CPU layer
 412          */
 413         kmem_cpu_cache_t cache_cpu[1];          /* max_ncpus actual elements */
 414 };
 415 
 416 typedef struct kmem_cpu_log_header {
 417         kmutex_t        clh_lock;
 418         char            *clh_current;
 419         size_t          clh_avail;
 420         int             clh_chunk;
 421         int             clh_hits;
 422         char            clh_pad[64 - sizeof (kmutex_t) - sizeof (char *) -
 423                                 sizeof (size_t) - 2 * sizeof (int)];
 424 } kmem_cpu_log_header_t;
 425 
 426 typedef struct kmem_log_header {
 427         kmutex_t        lh_lock;
 428         char            *lh_base;