1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://zfsonlinux.org/>.
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 *****************************************************************************
24 * Solaris Porting LAyer Tests (SPLAT) Kmem Tests.
25 \*****************************************************************************/
28 #include <sys/kmem_cache.h>
30 #include <sys/random.h>
31 #include <sys/thread.h>
32 #include <sys/vmsystm.h>
33 #include "splat-internal.h"
35 #define SPLAT_KMEM_NAME "kmem"
36 #define SPLAT_KMEM_DESC "Kernel Malloc/Slab Tests"
38 #define SPLAT_KMEM_TEST1_ID 0x0101
39 #define SPLAT_KMEM_TEST1_NAME "kmem_alloc"
40 #define SPLAT_KMEM_TEST1_DESC "Memory allocation test (kmem_alloc)"
42 #define SPLAT_KMEM_TEST2_ID 0x0102
43 #define SPLAT_KMEM_TEST2_NAME "kmem_zalloc"
44 #define SPLAT_KMEM_TEST2_DESC "Memory allocation test (kmem_zalloc)"
46 #define SPLAT_KMEM_TEST3_ID 0x0103
47 #define SPLAT_KMEM_TEST3_NAME "vmem_alloc"
48 #define SPLAT_KMEM_TEST3_DESC "Memory allocation test (vmem_alloc)"
50 #define SPLAT_KMEM_TEST4_ID 0x0104
51 #define SPLAT_KMEM_TEST4_NAME "vmem_zalloc"
52 #define SPLAT_KMEM_TEST4_DESC "Memory allocation test (vmem_zalloc)"
54 #define SPLAT_KMEM_TEST5_ID 0x0105
55 #define SPLAT_KMEM_TEST5_NAME "slab_small"
56 #define SPLAT_KMEM_TEST5_DESC "Slab ctor/dtor test (small)"
58 #define SPLAT_KMEM_TEST6_ID 0x0106
59 #define SPLAT_KMEM_TEST6_NAME "slab_large"
60 #define SPLAT_KMEM_TEST6_DESC "Slab ctor/dtor test (large)"
62 #define SPLAT_KMEM_TEST7_ID 0x0107
63 #define SPLAT_KMEM_TEST7_NAME "slab_align"
64 #define SPLAT_KMEM_TEST7_DESC "Slab alignment test"
66 #define SPLAT_KMEM_TEST8_ID 0x0108
67 #define SPLAT_KMEM_TEST8_NAME "slab_reap"
68 #define SPLAT_KMEM_TEST8_DESC "Slab reaping test"
70 #define SPLAT_KMEM_TEST9_ID 0x0109
71 #define SPLAT_KMEM_TEST9_NAME "slab_age"
72 #define SPLAT_KMEM_TEST9_DESC "Slab aging test"
74 #define SPLAT_KMEM_TEST10_ID 0x010a
75 #define SPLAT_KMEM_TEST10_NAME "slab_lock"
76 #define SPLAT_KMEM_TEST10_DESC "Slab locking test"
79 #define SPLAT_KMEM_TEST11_ID 0x010b
80 #define SPLAT_KMEM_TEST11_NAME "slab_overcommit"
81 #define SPLAT_KMEM_TEST11_DESC "Slab memory overcommit test"
84 #define SPLAT_KMEM_TEST13_ID 0x010d
85 #define SPLAT_KMEM_TEST13_NAME "slab_reclaim"
86 #define SPLAT_KMEM_TEST13_DESC "Slab direct memory reclaim test"
88 #define SPLAT_KMEM_ALLOC_COUNT 10
89 #define SPLAT_VMEM_ALLOC_COUNT 10
93 splat_kmem_test1(struct file
*file
, void *arg
)
95 void *ptr
[SPLAT_KMEM_ALLOC_COUNT
];
99 while ((!rc
) && (size
<= spl_kmem_alloc_warn
)) {
102 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++) {
103 ptr
[i
] = kmem_alloc(size
, KM_SLEEP
);
108 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++)
110 kmem_free(ptr
[i
], size
);
112 splat_vprint(file
, SPLAT_KMEM_TEST1_NAME
,
113 "%d byte allocations, %d/%d successful\n",
114 size
, count
, SPLAT_KMEM_ALLOC_COUNT
);
115 if (count
!= SPLAT_KMEM_ALLOC_COUNT
)
125 splat_kmem_test2(struct file
*file
, void *arg
)
127 void *ptr
[SPLAT_KMEM_ALLOC_COUNT
];
128 int size
= PAGE_SIZE
;
129 int i
, j
, count
, rc
= 0;
131 while ((!rc
) && (size
<= spl_kmem_alloc_warn
)) {
134 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++) {
135 ptr
[i
] = kmem_zalloc(size
, KM_SLEEP
);
140 /* Ensure buffer has been zero filled */
141 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++) {
142 for (j
= 0; j
< size
; j
++) {
143 if (((char *)ptr
[i
])[j
] != '\0') {
144 splat_vprint(file
,SPLAT_KMEM_TEST2_NAME
,
145 "%d-byte allocation was "
146 "not zeroed\n", size
);
152 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++)
154 kmem_free(ptr
[i
], size
);
156 splat_vprint(file
, SPLAT_KMEM_TEST2_NAME
,
157 "%d byte allocations, %d/%d successful\n",
158 size
, count
, SPLAT_KMEM_ALLOC_COUNT
);
159 if (count
!= SPLAT_KMEM_ALLOC_COUNT
)
169 splat_kmem_test3(struct file
*file
, void *arg
)
171 void *ptr
[SPLAT_VMEM_ALLOC_COUNT
];
172 int size
= PAGE_SIZE
;
173 int i
, count
, rc
= 0;
176 * Test up to 4x the maximum kmem_alloc() size to ensure both
177 * the kmem_alloc() and vmem_alloc() call paths are used.
179 while ((!rc
) && (size
<= (4 * spl_kmem_alloc_max
))) {
182 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++) {
183 ptr
[i
] = vmem_alloc(size
, KM_SLEEP
);
188 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++)
190 vmem_free(ptr
[i
], size
);
192 splat_vprint(file
, SPLAT_KMEM_TEST3_NAME
,
193 "%d byte allocations, %d/%d successful\n",
194 size
, count
, SPLAT_VMEM_ALLOC_COUNT
);
195 if (count
!= SPLAT_VMEM_ALLOC_COUNT
)
205 splat_kmem_test4(struct file
*file
, void *arg
)
207 void *ptr
[SPLAT_VMEM_ALLOC_COUNT
];
208 int size
= PAGE_SIZE
;
209 int i
, j
, count
, rc
= 0;
212 * Test up to 4x the maximum kmem_zalloc() size to ensure both
213 * the kmem_zalloc() and vmem_zalloc() call paths are used.
215 while ((!rc
) && (size
<= (4 * spl_kmem_alloc_max
))) {
218 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++) {
219 ptr
[i
] = vmem_zalloc(size
, KM_SLEEP
);
224 /* Ensure buffer has been zero filled */
225 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++) {
226 for (j
= 0; j
< size
; j
++) {
227 if (((char *)ptr
[i
])[j
] != '\0') {
228 splat_vprint(file
, SPLAT_KMEM_TEST4_NAME
,
229 "%d-byte allocation was "
230 "not zeroed\n", size
);
236 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++)
238 vmem_free(ptr
[i
], size
);
240 splat_vprint(file
, SPLAT_KMEM_TEST4_NAME
,
241 "%d byte allocations, %d/%d successful\n",
242 size
, count
, SPLAT_VMEM_ALLOC_COUNT
);
243 if (count
!= SPLAT_VMEM_ALLOC_COUNT
)
252 #define SPLAT_KMEM_TEST_MAGIC 0x004488CCUL
253 #define SPLAT_KMEM_CACHE_NAME "kmem_test"
254 #define SPLAT_KMEM_OBJ_COUNT 1024
255 #define SPLAT_KMEM_OBJ_RECLAIM 32 /* objects */
256 #define SPLAT_KMEM_THREADS 32
258 #define KCP_FLAG_READY 0x01
260 typedef struct kmem_cache_data
{
261 unsigned long kcd_magic
;
262 struct list_head kcd_node
;
267 typedef struct kmem_cache_thread
{
270 struct list_head kct_list
;
271 } kmem_cache_thread_t
;
273 typedef struct kmem_cache_priv
{
274 unsigned long kcp_magic
;
275 struct file
*kcp_file
;
276 kmem_cache_t
*kcp_cache
;
278 wait_queue_head_t kcp_ctl_waitq
;
279 wait_queue_head_t kcp_thr_waitq
;
282 kmem_cache_thread_t
*kcp_kct
[SPLAT_KMEM_THREADS
];
290 static kmem_cache_priv_t
*
291 splat_kmem_cache_test_kcp_alloc(struct file
*file
, char *name
,
292 int size
, int align
, int alloc
)
294 kmem_cache_priv_t
*kcp
;
296 kcp
= kmem_zalloc(sizeof(kmem_cache_priv_t
), KM_SLEEP
);
300 kcp
->kcp_magic
= SPLAT_KMEM_TEST_MAGIC
;
301 kcp
->kcp_file
= file
;
302 kcp
->kcp_cache
= NULL
;
303 spin_lock_init(&kcp
->kcp_lock
);
304 init_waitqueue_head(&kcp
->kcp_ctl_waitq
);
305 init_waitqueue_head(&kcp
->kcp_thr_waitq
);
307 kcp
->kcp_kct_count
= -1;
308 kcp
->kcp_size
= size
;
309 kcp
->kcp_align
= align
;
311 kcp
->kcp_alloc
= alloc
;
318 splat_kmem_cache_test_kcp_free(kmem_cache_priv_t
*kcp
)
320 kmem_free(kcp
, sizeof(kmem_cache_priv_t
));
323 static kmem_cache_thread_t
*
324 splat_kmem_cache_test_kct_alloc(kmem_cache_priv_t
*kcp
, int id
)
326 kmem_cache_thread_t
*kct
;
328 ASSERT3S(id
, <, SPLAT_KMEM_THREADS
);
329 ASSERT(kcp
->kcp_kct
[id
] == NULL
);
331 kct
= kmem_zalloc(sizeof(kmem_cache_thread_t
), KM_SLEEP
);
335 spin_lock_init(&kct
->kct_lock
);
337 INIT_LIST_HEAD(&kct
->kct_list
);
339 spin_lock(&kcp
->kcp_lock
);
340 kcp
->kcp_kct
[id
] = kct
;
341 spin_unlock(&kcp
->kcp_lock
);
347 splat_kmem_cache_test_kct_free(kmem_cache_priv_t
*kcp
,
348 kmem_cache_thread_t
*kct
)
350 spin_lock(&kcp
->kcp_lock
);
351 kcp
->kcp_kct
[kct
->kct_id
] = NULL
;
352 spin_unlock(&kcp
->kcp_lock
);
354 kmem_free(kct
, sizeof(kmem_cache_thread_t
));
358 splat_kmem_cache_test_kcd_free(kmem_cache_priv_t
*kcp
,
359 kmem_cache_thread_t
*kct
)
361 kmem_cache_data_t
*kcd
;
363 spin_lock(&kct
->kct_lock
);
364 while (!list_empty(&kct
->kct_list
)) {
365 kcd
= list_entry(kct
->kct_list
.next
,
366 kmem_cache_data_t
, kcd_node
);
367 list_del(&kcd
->kcd_node
);
368 spin_unlock(&kct
->kct_lock
);
370 kmem_cache_free(kcp
->kcp_cache
, kcd
);
372 spin_lock(&kct
->kct_lock
);
374 spin_unlock(&kct
->kct_lock
);
378 splat_kmem_cache_test_kcd_alloc(kmem_cache_priv_t
*kcp
,
379 kmem_cache_thread_t
*kct
, int count
)
381 kmem_cache_data_t
*kcd
;
384 for (i
= 0; i
< count
; i
++) {
385 kcd
= kmem_cache_alloc(kcp
->kcp_cache
, KM_SLEEP
);
387 splat_kmem_cache_test_kcd_free(kcp
, kct
);
391 spin_lock(&kct
->kct_lock
);
392 list_add_tail(&kcd
->kcd_node
, &kct
->kct_list
);
393 spin_unlock(&kct
->kct_lock
);
400 splat_kmem_cache_test_debug(struct file
*file
, char *name
,
401 kmem_cache_priv_t
*kcp
)
405 splat_vprint(file
, name
, "%s cache objects %d",
406 kcp
->kcp_cache
->skc_name
, kcp
->kcp_count
);
408 if (kcp
->kcp_cache
->skc_flags
& (KMC_KMEM
| KMC_VMEM
)) {
409 splat_vprint(file
, name
, ", slabs %u/%u objs %u/%u",
410 (unsigned)kcp
->kcp_cache
->skc_slab_alloc
,
411 (unsigned)kcp
->kcp_cache
->skc_slab_total
,
412 (unsigned)kcp
->kcp_cache
->skc_obj_alloc
,
413 (unsigned)kcp
->kcp_cache
->skc_obj_total
);
415 if (!(kcp
->kcp_cache
->skc_flags
& KMC_NOMAGAZINE
)) {
416 splat_vprint(file
, name
, "%s", "mags");
418 for_each_online_cpu(j
)
419 splat_print(file
, "%u/%u ",
420 kcp
->kcp_cache
->skc_mag
[j
]->skm_avail
,
421 kcp
->kcp_cache
->skc_mag
[j
]->skm_size
);
425 splat_print(file
, "%s\n", "");
429 splat_kmem_cache_test_constructor(void *ptr
, void *priv
, int flags
)
431 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)priv
;
432 kmem_cache_data_t
*kcd
= (kmem_cache_data_t
*)ptr
;
435 kcd
->kcd_magic
= kcp
->kcp_magic
;
436 INIT_LIST_HEAD(&kcd
->kcd_node
);
438 memset(kcd
->kcd_buf
, 0xaa, kcp
->kcp_size
- (sizeof *kcd
));
446 splat_kmem_cache_test_destructor(void *ptr
, void *priv
)
448 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)priv
;
449 kmem_cache_data_t
*kcd
= (kmem_cache_data_t
*)ptr
;
454 memset(kcd
->kcd_buf
, 0xbb, kcp
->kcp_size
- (sizeof *kcd
));
462 * Generic reclaim function which assumes that all objects may
463 * be reclaimed at any time. We free a small percentage of the
464 * objects linked off the kcp or kct[] every time we are called.
467 splat_kmem_cache_test_reclaim(void *priv
)
469 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)priv
;
470 kmem_cache_thread_t
*kct
;
471 kmem_cache_data_t
*kcd
;
475 ASSERT(kcp
->kcp_magic
== SPLAT_KMEM_TEST_MAGIC
);
477 /* For each kct thread reclaim some objects */
478 spin_lock(&kcp
->kcp_lock
);
479 for (i
= 0; i
< SPLAT_KMEM_THREADS
; i
++) {
480 kct
= kcp
->kcp_kct
[i
];
484 spin_unlock(&kcp
->kcp_lock
);
485 spin_lock(&kct
->kct_lock
);
487 count
= SPLAT_KMEM_OBJ_RECLAIM
;
488 while (count
> 0 && !list_empty(&kct
->kct_list
)) {
489 kcd
= list_entry(kct
->kct_list
.next
,
490 kmem_cache_data_t
, kcd_node
);
491 list_del(&kcd
->kcd_node
);
492 list_add(&kcd
->kcd_node
, &reclaim
);
496 spin_unlock(&kct
->kct_lock
);
497 spin_lock(&kcp
->kcp_lock
);
499 spin_unlock(&kcp
->kcp_lock
);
501 /* Freed outside the spin lock */
502 while (!list_empty(&reclaim
)) {
503 kcd
= list_entry(reclaim
.next
, kmem_cache_data_t
, kcd_node
);
504 list_del(&kcd
->kcd_node
);
505 kmem_cache_free(kcp
->kcp_cache
, kcd
);
512 splat_kmem_cache_test_threads(kmem_cache_priv_t
*kcp
, int threads
)
516 spin_lock(&kcp
->kcp_lock
);
517 rc
= (kcp
->kcp_kct_count
== threads
);
518 spin_unlock(&kcp
->kcp_lock
);
524 splat_kmem_cache_test_flags(kmem_cache_priv_t
*kcp
, int flags
)
528 spin_lock(&kcp
->kcp_lock
);
529 rc
= (kcp
->kcp_flags
& flags
);
530 spin_unlock(&kcp
->kcp_lock
);
536 splat_kmem_cache_test_thread(void *arg
)
538 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)arg
;
539 kmem_cache_thread_t
*kct
;
542 ASSERT(kcp
->kcp_magic
== SPLAT_KMEM_TEST_MAGIC
);
544 /* Assign thread ids */
545 spin_lock(&kcp
->kcp_lock
);
546 if (kcp
->kcp_kct_count
== -1)
547 kcp
->kcp_kct_count
= 0;
549 id
= kcp
->kcp_kct_count
;
550 kcp
->kcp_kct_count
++;
551 spin_unlock(&kcp
->kcp_lock
);
553 kct
= splat_kmem_cache_test_kct_alloc(kcp
, id
);
559 /* Wait for all threads to have started and report they are ready */
560 if (kcp
->kcp_kct_count
== SPLAT_KMEM_THREADS
)
561 wake_up(&kcp
->kcp_ctl_waitq
);
563 wait_event(kcp
->kcp_thr_waitq
,
564 splat_kmem_cache_test_flags(kcp
, KCP_FLAG_READY
));
566 /* Create and destroy objects */
567 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, kcp
->kcp_alloc
);
568 splat_kmem_cache_test_kcd_free(kcp
, kct
);
571 splat_kmem_cache_test_kct_free(kcp
, kct
);
573 spin_lock(&kcp
->kcp_lock
);
577 if ((--kcp
->kcp_kct_count
) == 0)
578 wake_up(&kcp
->kcp_ctl_waitq
);
580 spin_unlock(&kcp
->kcp_lock
);
586 splat_kmem_cache_test(struct file
*file
, void *arg
, char *name
,
587 int size
, int align
, int flags
)
589 kmem_cache_priv_t
*kcp
= NULL
;
590 kmem_cache_data_t
**kcd
= NULL
;
591 int i
, rc
= 0, objs
= 0;
593 /* Limit size for low memory machines (1/128 of memory) */
594 size
= MIN(size
, (physmem
* PAGE_SIZE
) >> 7);
596 splat_vprint(file
, name
,
597 "Testing size=%d, align=%d, flags=0x%04x\n",
600 kcp
= splat_kmem_cache_test_kcp_alloc(file
, name
, size
, align
, 0);
602 splat_vprint(file
, name
, "Unable to create '%s'\n", "kcp");
606 kcp
->kcp_cache
= kmem_cache_create(SPLAT_KMEM_CACHE_NAME
,
607 kcp
->kcp_size
, kcp
->kcp_align
,
608 splat_kmem_cache_test_constructor
,
609 splat_kmem_cache_test_destructor
,
610 NULL
, kcp
, NULL
, flags
);
611 if (kcp
->kcp_cache
== NULL
) {
612 splat_vprint(file
, name
, "Unable to create "
613 "name='%s', size=%d, align=%d, flags=0x%x\n",
614 SPLAT_KMEM_CACHE_NAME
, size
, align
, flags
);
620 * Allocate several slabs worth of objects to verify functionality.
621 * However, on 32-bit systems with limited address space constrain
622 * it to a single slab for the purposes of this test.
625 objs
= kcp
->kcp_cache
->skc_slab_objs
* 4;
629 kcd
= kmem_zalloc(sizeof (kmem_cache_data_t
*) * objs
, KM_SLEEP
);
631 splat_vprint(file
, name
, "Unable to allocate pointers "
632 "for %d objects\n", objs
);
637 for (i
= 0; i
< objs
; i
++) {
638 kcd
[i
] = kmem_cache_alloc(kcp
->kcp_cache
, KM_SLEEP
);
639 if (kcd
[i
] == NULL
) {
640 splat_vprint(file
, name
, "Unable to allocate "
641 "from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
646 if (!kcd
[i
]->kcd_flag
) {
647 splat_vprint(file
, name
, "Failed to run constructor "
648 "for '%s'\n", SPLAT_KMEM_CACHE_NAME
);
653 if (kcd
[i
]->kcd_magic
!= kcp
->kcp_magic
) {
654 splat_vprint(file
, name
,
655 "Failed to pass private data to constructor "
656 "for '%s'\n", SPLAT_KMEM_CACHE_NAME
);
662 for (i
= 0; i
< objs
; i
++) {
663 kmem_cache_free(kcp
->kcp_cache
, kcd
[i
]);
665 /* Destructors are run for every kmem_cache_free() */
666 if (kcd
[i
]->kcd_flag
) {
667 splat_vprint(file
, name
,
668 "Failed to run destructor for '%s'\n",
669 SPLAT_KMEM_CACHE_NAME
);
675 if (kcp
->kcp_count
) {
676 splat_vprint(file
, name
,
677 "Failed to run destructor on all slab objects for '%s'\n",
678 SPLAT_KMEM_CACHE_NAME
);
682 kmem_free(kcd
, sizeof (kmem_cache_data_t
*) * objs
);
683 kmem_cache_destroy(kcp
->kcp_cache
);
685 splat_kmem_cache_test_kcp_free(kcp
);
686 splat_vprint(file
, name
,
687 "Success ran alloc'd/free'd %d objects of size %d\n",
694 for (i
= 0; i
< objs
; i
++) {
696 kmem_cache_free(kcp
->kcp_cache
, kcd
[i
]);
699 kmem_free(kcd
, sizeof (kmem_cache_data_t
*) * objs
);
703 kmem_cache_destroy(kcp
->kcp_cache
);
705 splat_kmem_cache_test_kcp_free(kcp
);
711 splat_kmem_cache_thread_test(struct file
*file
, void *arg
, char *name
,
712 int size
, int alloc
, int max_time
)
714 kmem_cache_priv_t
*kcp
;
716 struct timespec start
, stop
, delta
;
720 kcp
= splat_kmem_cache_test_kcp_alloc(file
, name
, size
, 0, alloc
);
722 splat_vprint(file
, name
, "Unable to create '%s'\n", "kcp");
726 (void)snprintf(cache_name
, 32, "%s-%d-%d",
727 SPLAT_KMEM_CACHE_NAME
, size
, alloc
);
729 kmem_cache_create(cache_name
, kcp
->kcp_size
, 0,
730 splat_kmem_cache_test_constructor
,
731 splat_kmem_cache_test_destructor
,
732 splat_kmem_cache_test_reclaim
,
734 if (!kcp
->kcp_cache
) {
735 splat_vprint(file
, name
, "Unable to create '%s'\n", cache_name
);
740 getnstimeofday(&start
);
742 for (i
= 0; i
< SPLAT_KMEM_THREADS
; i
++) {
743 thr
= thread_create(NULL
, 0,
744 splat_kmem_cache_test_thread
,
745 kcp
, 0, &p0
, TS_RUN
, defclsyspri
);
752 /* Sleep until all threads have started, then set the ready
753 * flag and wake them all up for maximum concurrency. */
754 wait_event(kcp
->kcp_ctl_waitq
,
755 splat_kmem_cache_test_threads(kcp
, SPLAT_KMEM_THREADS
));
757 spin_lock(&kcp
->kcp_lock
);
758 kcp
->kcp_flags
|= KCP_FLAG_READY
;
759 spin_unlock(&kcp
->kcp_lock
);
760 wake_up_all(&kcp
->kcp_thr_waitq
);
762 /* Sleep until all thread have finished */
763 wait_event(kcp
->kcp_ctl_waitq
, splat_kmem_cache_test_threads(kcp
, 0));
765 getnstimeofday(&stop
);
766 delta
= timespec_sub(stop
, start
);
768 splat_vprint(file
, name
,
770 "%lu/%lu/%lu\t%lu/%lu/%lu\n",
771 kcp
->kcp_cache
->skc_name
,
772 delta
.tv_sec
, delta
.tv_nsec
,
773 (unsigned long)kcp
->kcp_cache
->skc_slab_total
,
774 (unsigned long)kcp
->kcp_cache
->skc_slab_max
,
775 (unsigned long)(kcp
->kcp_alloc
*
777 SPL_KMEM_CACHE_OBJ_PER_SLAB
),
778 (unsigned long)kcp
->kcp_cache
->skc_obj_total
,
779 (unsigned long)kcp
->kcp_cache
->skc_obj_max
,
780 (unsigned long)(kcp
->kcp_alloc
*
781 SPLAT_KMEM_THREADS
));
783 if (delta
.tv_sec
>= max_time
)
786 if (!rc
&& kcp
->kcp_rc
)
790 kmem_cache_destroy(kcp
->kcp_cache
);
792 splat_kmem_cache_test_kcp_free(kcp
);
796 /* Validate small object cache behavior for dynamic/kmem/vmem caches */
798 splat_kmem_test5(struct file
*file
, void *arg
)
800 char *name
= SPLAT_KMEM_TEST5_NAME
;
803 /* Randomly pick small object sizes and alignments. */
804 for (i
= 0; i
< 100; i
++) {
805 int size
, align
, flags
= 0;
808 /* Evenly distribute tests over all value cache types */
809 get_random_bytes((void *)&rnd
, sizeof (uint32_t));
810 switch (rnd
& 0x03) {
826 /* The following flags are set with a 1/10 chance */
827 flags
|= ((((rnd
>> 8) % 10) == 0) ? KMC_OFFSLAB
: 0);
828 flags
|= ((((rnd
>> 16) % 10) == 0) ? KMC_NOEMERGENCY
: 0);
830 /* 32b - PAGE_SIZE */
831 get_random_bytes((void *)&rnd
, sizeof (uint32_t));
832 size
= MAX(rnd
% (PAGE_SIZE
+ 1), 32);
834 /* 2^N where (3 <= N <= PAGE_SHIFT) */
835 get_random_bytes((void *)&rnd
, sizeof (uint32_t));
836 align
= (1 << MAX(3, rnd
% (PAGE_SHIFT
+ 1)));
838 rc
= splat_kmem_cache_test(file
, arg
, name
, size
, align
, flags
);
847 * Validate large object cache behavior for dynamic/kmem/vmem caches
850 splat_kmem_test6(struct file
*file
, void *arg
)
852 char *name
= SPLAT_KMEM_TEST6_NAME
;
853 int i
, max_size
, rc
= 0;
855 /* Randomly pick large object sizes and alignments. */
856 for (i
= 0; i
< 100; i
++) {
857 int size
, align
, flags
= 0;
860 /* Evenly distribute tests over all value cache types */
861 get_random_bytes((void *)&rnd
, sizeof (uint32_t));
862 switch (rnd
& 0x03) {
866 max_size
= (SPL_KMEM_CACHE_MAX_SIZE
* 1024 * 1024) / 2;
870 max_size
= (SPL_MAX_ORDER_NR_PAGES
- 2) * PAGE_SIZE
;
874 max_size
= (SPL_KMEM_CACHE_MAX_SIZE
* 1024 * 1024) / 2;
878 max_size
= SPL_MAX_KMEM_ORDER_NR_PAGES
* PAGE_SIZE
;
882 /* The following flags are set with a 1/10 chance */
883 flags
|= ((((rnd
>> 8) % 10) == 0) ? KMC_OFFSLAB
: 0);
884 flags
|= ((((rnd
>> 16) % 10) == 0) ? KMC_NOEMERGENCY
: 0);
886 /* PAGE_SIZE - max_size */
887 get_random_bytes((void *)&rnd
, sizeof (uint32_t));
888 size
= MAX(rnd
% (max_size
+ 1), PAGE_SIZE
),
890 /* 2^N where (3 <= N <= PAGE_SHIFT) */
891 get_random_bytes((void *)&rnd
, sizeof (uint32_t));
892 align
= (1 << MAX(3, rnd
% (PAGE_SHIFT
+ 1)));
894 rc
= splat_kmem_cache_test(file
, arg
, name
, size
, align
, flags
);
903 * Validate object alignment cache behavior for caches
906 splat_kmem_test7(struct file
*file
, void *arg
)
908 char *name
= SPLAT_KMEM_TEST7_NAME
;
909 int max_size
= (SPL_KMEM_CACHE_MAX_SIZE
* 1024 * 1024) / 2;
912 for (i
= SPL_KMEM_CACHE_ALIGN
; i
<= PAGE_SIZE
; i
*= 2) {
915 get_random_bytes((void *)&size
, sizeof (uint32_t));
916 size
= MAX(size
% (max_size
+ 1), 32);
918 rc
= splat_kmem_cache_test(file
, arg
, name
, size
, i
, 0);
922 rc
= splat_kmem_cache_test(file
, arg
, name
, size
, i
,
932 * Validate kmem_cache_reap() by requesting the slab cache free any objects
933 * it can. For a few reasons this may not immediately result in more free
934 * memory even if objects are freed. First off, due to fragmentation we
935 * may not be able to reclaim any slabs. Secondly, even if we do we fully
936 * clear some slabs we will not want to immediately reclaim all of them
937 * because we may contend with cache allocations and thrash. What we want
938 * to see is the slab size decrease more gradually as it becomes clear they
939 * will not be needed. This should be achievable in less than a minute.
940 * If it takes longer than this something has gone wrong.
943 splat_kmem_test8(struct file
*file
, void *arg
)
945 kmem_cache_priv_t
*kcp
;
946 kmem_cache_thread_t
*kct
;
947 unsigned int spl_kmem_cache_expire_old
;
950 /* Enable cache aging just for this test if it is disabled */
951 spl_kmem_cache_expire_old
= spl_kmem_cache_expire
;
952 spl_kmem_cache_expire
= KMC_EXPIRE_AGE
;
954 kcp
= splat_kmem_cache_test_kcp_alloc(file
, SPLAT_KMEM_TEST8_NAME
,
957 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
958 "Unable to create '%s'\n", "kcp");
964 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
, kcp
->kcp_size
, 0,
965 splat_kmem_cache_test_constructor
,
966 splat_kmem_cache_test_destructor
,
967 splat_kmem_cache_test_reclaim
,
969 if (!kcp
->kcp_cache
) {
970 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
971 "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME
);
976 kct
= splat_kmem_cache_test_kct_alloc(kcp
, 0);
978 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
979 "Unable to create '%s'\n", "kct");
984 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, SPLAT_KMEM_OBJ_COUNT
);
986 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
, "Unable to "
987 "allocate from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
991 /* Force reclaim every 1/10 a second for 60 seconds. */
992 for (i
= 0; i
< 600; i
++) {
993 kmem_cache_reap_now(kcp
->kcp_cache
);
994 splat_kmem_cache_test_debug(file
, SPLAT_KMEM_TEST8_NAME
, kcp
);
996 if (kcp
->kcp_count
== 0)
999 set_current_state(TASK_INTERRUPTIBLE
);
1000 schedule_timeout(HZ
/ 10);
1003 if (kcp
->kcp_count
== 0) {
1004 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
1005 "Successfully created %d objects "
1006 "in cache %s and reclaimed them\n",
1007 SPLAT_KMEM_OBJ_COUNT
, SPLAT_KMEM_CACHE_NAME
);
1009 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
1010 "Failed to reclaim %u/%d objects from cache %s\n",
1011 (unsigned)kcp
->kcp_count
,
1012 SPLAT_KMEM_OBJ_COUNT
, SPLAT_KMEM_CACHE_NAME
);
1016 /* Cleanup our mess (for failure case of time expiring) */
1017 splat_kmem_cache_test_kcd_free(kcp
, kct
);
1019 splat_kmem_cache_test_kct_free(kcp
, kct
);
1021 kmem_cache_destroy(kcp
->kcp_cache
);
1023 splat_kmem_cache_test_kcp_free(kcp
);
1025 spl_kmem_cache_expire
= spl_kmem_cache_expire_old
;
1030 /* Test cache aging, we have allocated a large number of objects thus
1031 * creating a large number of slabs and then free'd them all. However,
1032 * since there should be little memory pressure at the moment those
1033 * slabs have not been freed. What we want to see is the slab size
1034 * decrease gradually as it becomes clear they will not be be needed.
1035 * This should be achievable in less than minute. If it takes longer
1036 * than this something has gone wrong.
1039 splat_kmem_test9(struct file
*file
, void *arg
)
1041 kmem_cache_priv_t
*kcp
;
1042 kmem_cache_thread_t
*kct
;
1043 unsigned int spl_kmem_cache_expire_old
;
1044 int i
, rc
= 0, count
= SPLAT_KMEM_OBJ_COUNT
* 128;
1046 /* Enable cache aging just for this test if it is disabled */
1047 spl_kmem_cache_expire_old
= spl_kmem_cache_expire
;
1048 spl_kmem_cache_expire
= KMC_EXPIRE_AGE
;
1050 kcp
= splat_kmem_cache_test_kcp_alloc(file
, SPLAT_KMEM_TEST9_NAME
,
1053 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
1054 "Unable to create '%s'\n", "kcp");
1060 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
, kcp
->kcp_size
, 0,
1061 splat_kmem_cache_test_constructor
,
1062 splat_kmem_cache_test_destructor
,
1063 NULL
, kcp
, NULL
, 0);
1064 if (!kcp
->kcp_cache
) {
1065 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
1066 "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME
);
1071 kct
= splat_kmem_cache_test_kct_alloc(kcp
, 0);
1073 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
1074 "Unable to create '%s'\n", "kct");
1079 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, count
);
1081 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
, "Unable to "
1082 "allocate from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
1086 splat_kmem_cache_test_kcd_free(kcp
, kct
);
1088 for (i
= 0; i
< 60; i
++) {
1089 splat_kmem_cache_test_debug(file
, SPLAT_KMEM_TEST9_NAME
, kcp
);
1091 if (kcp
->kcp_count
== 0)
1094 set_current_state(TASK_INTERRUPTIBLE
);
1095 schedule_timeout(HZ
);
1098 if (kcp
->kcp_count
== 0) {
1099 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
1100 "Successfully created %d objects "
1101 "in cache %s and reclaimed them\n",
1102 count
, SPLAT_KMEM_CACHE_NAME
);
1104 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
1105 "Failed to reclaim %u/%d objects from cache %s\n",
1106 (unsigned)kcp
->kcp_count
, count
,
1107 SPLAT_KMEM_CACHE_NAME
);
1112 splat_kmem_cache_test_kct_free(kcp
, kct
);
1114 kmem_cache_destroy(kcp
->kcp_cache
);
1116 splat_kmem_cache_test_kcp_free(kcp
);
1118 spl_kmem_cache_expire
= spl_kmem_cache_expire_old
;
1124 * This test creates N threads with a shared kmem cache. They then all
1125 * concurrently allocate and free from the cache to stress the locking and
1126 * concurrent cache performance. If any one test takes longer than 5
1127 * seconds to complete it is treated as a failure and may indicate a
1128 * performance regression. On my test system no one test takes more
1129 * than 1 second to complete so a 5x slowdown likely a problem.
1132 splat_kmem_test10(struct file
*file
, void *arg
)
1134 uint64_t size
, alloc
, rc
= 0;
1136 for (size
= 32; size
<= 1024*1024; size
*= 2) {
1138 splat_vprint(file
, SPLAT_KMEM_TEST10_NAME
, "%-22s %s", "name",
1139 "time (sec)\tslabs \tobjs \thash\n");
1140 splat_vprint(file
, SPLAT_KMEM_TEST10_NAME
, "%-22s %s", "",
1141 " \ttot/max/calc\ttot/max/calc\n");
1143 for (alloc
= 1; alloc
<= 1024; alloc
*= 2) {
1145 /* Skip tests which exceed 1/2 of physical memory. */
1146 if (size
* alloc
* SPLAT_KMEM_THREADS
> physmem
/ 2)
1149 rc
= splat_kmem_cache_thread_test(file
, arg
,
1150 SPLAT_KMEM_TEST10_NAME
, size
, alloc
, 5);
1161 * This test creates N threads with a shared kmem cache which overcommits
1162 * memory by 4x. This makes it impossible for the slab to satify the
1163 * thread requirements without having its reclaim hook run which will
1164 * free objects back for use. This behavior is triggered by the linum VM
1165 * detecting a low memory condition on the node and invoking the shrinkers.
1166 * This should allow all the threads to complete while avoiding deadlock
1167 * and for the most part out of memory events. This is very tough on the
1168 * system so it is possible the test app may get oom'ed. This particular
1169 * test has proven troublesome on 32-bit archs with limited virtual
1170 * address space so it only run on 64-bit systems.
1173 splat_kmem_test11(struct file
*file
, void *arg
)
1175 uint64_t size
, alloc
, rc
;
1178 alloc
= ((4 * physmem
* PAGE_SIZE
) / size
) / SPLAT_KMEM_THREADS
;
1180 splat_vprint(file
, SPLAT_KMEM_TEST11_NAME
, "%-22s %s", "name",
1181 "time (sec)\tslabs \tobjs \thash\n");
1182 splat_vprint(file
, SPLAT_KMEM_TEST11_NAME
, "%-22s %s", "",
1183 " \ttot/max/calc\ttot/max/calc\n");
1185 rc
= splat_kmem_cache_thread_test(file
, arg
,
1186 SPLAT_KMEM_TEST11_NAME
, size
, alloc
, 60);
1192 typedef struct dummy_page
{
1193 struct list_head dp_list
;
1194 char dp_pad
[PAGE_SIZE
- sizeof(struct list_head
)];
1198 * This test is designed to verify that direct reclaim is functioning as
1199 * expected. We allocate a large number of objects thus creating a large
1200 * number of slabs. We then apply memory pressure and expect that the
1201 * direct reclaim path can easily recover those slabs. The registered
1202 * reclaim function will free the objects and the slab shrinker will call
1203 * it repeatedly until at least a single slab can be freed.
1205 * Note it may not be possible to reclaim every last slab via direct reclaim
1206 * without a failure because the shrinker_rwsem may be contended. For this
1207 * reason, quickly reclaiming 3/4 of the slabs is considered a success.
1209 * This should all be possible within 10 seconds. For reference, on a
1210 * system with 2G of memory this test takes roughly 0.2 seconds to run.
1211 * It may take longer on larger memory systems but should still easily
1212 * complete in the alloted 10 seconds.
1215 splat_kmem_test13(struct file
*file
, void *arg
)
1217 kmem_cache_priv_t
*kcp
;
1218 kmem_cache_thread_t
*kct
;
1220 struct list_head list
;
1221 struct timespec start
, stop
, delta
= { 0, 0 };
1222 int size
, count
, slabs
, fails
= 0;
1223 int i
, rc
= 0, max_time
= 10;
1226 count
= ((physmem
* PAGE_SIZE
) / 4 / size
);
1228 kcp
= splat_kmem_cache_test_kcp_alloc(file
, SPLAT_KMEM_TEST13_NAME
,
1231 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1232 "Unable to create '%s'\n", "kcp");
1238 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
, kcp
->kcp_size
, 0,
1239 splat_kmem_cache_test_constructor
,
1240 splat_kmem_cache_test_destructor
,
1241 splat_kmem_cache_test_reclaim
,
1243 if (!kcp
->kcp_cache
) {
1244 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1245 "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME
);
1250 kct
= splat_kmem_cache_test_kct_alloc(kcp
, 0);
1252 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1253 "Unable to create '%s'\n", "kct");
1258 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, count
);
1260 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
, "Unable to "
1261 "allocate from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
1266 slabs
= kcp
->kcp_cache
->skc_slab_total
;
1267 INIT_LIST_HEAD(&list
);
1268 getnstimeofday(&start
);
1270 /* Apply memory pressure */
1271 while (kcp
->kcp_cache
->skc_slab_total
> (slabs
>> 2)) {
1273 if ((i
% 10000) == 0)
1274 splat_kmem_cache_test_debug(
1275 file
, SPLAT_KMEM_TEST13_NAME
, kcp
);
1277 getnstimeofday(&stop
);
1278 delta
= timespec_sub(stop
, start
);
1279 if (delta
.tv_sec
>= max_time
) {
1280 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1281 "Failed to reclaim 3/4 of cache in %ds, "
1282 "%u/%u slabs remain\n", max_time
,
1283 (unsigned)kcp
->kcp_cache
->skc_slab_total
,
1289 dp
= (dummy_page_t
*)__get_free_page(GFP_KERNEL
);
1292 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1293 "Failed (%d) to allocate page with %u "
1294 "slabs still in the cache\n", fails
,
1295 (unsigned)kcp
->kcp_cache
->skc_slab_total
);
1299 list_add(&dp
->dp_list
, &list
);
1304 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1305 "Successfully created %u slabs and with %d alloc "
1306 "failures reclaimed 3/4 of them in %d.%03ds\n",
1308 (int)delta
.tv_sec
, (int)delta
.tv_nsec
/ 1000000);
1310 /* Release memory pressure pages */
1311 while (!list_empty(&list
)) {
1312 dp
= list_entry(list
.next
, dummy_page_t
, dp_list
);
1313 list_del_init(&dp
->dp_list
);
1314 free_page((unsigned long)dp
);
1317 /* Release remaining kmem cache objects */
1318 splat_kmem_cache_test_kcd_free(kcp
, kct
);
1320 splat_kmem_cache_test_kct_free(kcp
, kct
);
1322 kmem_cache_destroy(kcp
->kcp_cache
);
1324 splat_kmem_cache_test_kcp_free(kcp
);
1330 splat_kmem_init(void)
1332 splat_subsystem_t
*sub
;
1334 sub
= kmalloc(sizeof(*sub
), GFP_KERNEL
);
1338 memset(sub
, 0, sizeof(*sub
));
1339 strncpy(sub
->desc
.name
, SPLAT_KMEM_NAME
, SPLAT_NAME_SIZE
);
1340 strncpy(sub
->desc
.desc
, SPLAT_KMEM_DESC
, SPLAT_DESC_SIZE
);
1341 INIT_LIST_HEAD(&sub
->subsystem_list
);
1342 INIT_LIST_HEAD(&sub
->test_list
);
1343 spin_lock_init(&sub
->test_lock
);
1344 sub
->desc
.id
= SPLAT_SUBSYSTEM_KMEM
;
1346 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST1_NAME
, SPLAT_KMEM_TEST1_DESC
,
1347 SPLAT_KMEM_TEST1_ID
, splat_kmem_test1
);
1348 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST2_NAME
, SPLAT_KMEM_TEST2_DESC
,
1349 SPLAT_KMEM_TEST2_ID
, splat_kmem_test2
);
1350 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST3_NAME
, SPLAT_KMEM_TEST3_DESC
,
1351 SPLAT_KMEM_TEST3_ID
, splat_kmem_test3
);
1352 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST4_NAME
, SPLAT_KMEM_TEST4_DESC
,
1353 SPLAT_KMEM_TEST4_ID
, splat_kmem_test4
);
1354 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST5_NAME
, SPLAT_KMEM_TEST5_DESC
,
1355 SPLAT_KMEM_TEST5_ID
, splat_kmem_test5
);
1356 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST6_NAME
, SPLAT_KMEM_TEST6_DESC
,
1357 SPLAT_KMEM_TEST6_ID
, splat_kmem_test6
);
1358 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST7_NAME
, SPLAT_KMEM_TEST7_DESC
,
1359 SPLAT_KMEM_TEST7_ID
, splat_kmem_test7
);
1360 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST8_NAME
, SPLAT_KMEM_TEST8_DESC
,
1361 SPLAT_KMEM_TEST8_ID
, splat_kmem_test8
);
1362 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST9_NAME
, SPLAT_KMEM_TEST9_DESC
,
1363 SPLAT_KMEM_TEST9_ID
, splat_kmem_test9
);
1364 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST10_NAME
, SPLAT_KMEM_TEST10_DESC
,
1365 SPLAT_KMEM_TEST10_ID
, splat_kmem_test10
);
1367 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST11_NAME
, SPLAT_KMEM_TEST11_DESC
,
1368 SPLAT_KMEM_TEST11_ID
, splat_kmem_test11
);
1370 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST13_NAME
, SPLAT_KMEM_TEST13_DESC
,
1371 SPLAT_KMEM_TEST13_ID
, splat_kmem_test13
);
1377 splat_kmem_fini(splat_subsystem_t
*sub
)
1380 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST13_ID
);
1382 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST11_ID
);
1384 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST10_ID
);
1385 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST9_ID
);
1386 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST8_ID
);
1387 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST7_ID
);
1388 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST6_ID
);
1389 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST5_ID
);
1390 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST4_ID
);
1391 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST3_ID
);
1392 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST2_ID
);
1393 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST1_ID
);
1399 splat_kmem_id(void) {
1400 return SPLAT_SUBSYSTEM_KMEM
;