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://github.com/behlendorf/spl/>.
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/thread.h>
29 #include "splat-internal.h"
31 #define SPLAT_KMEM_NAME "kmem"
32 #define SPLAT_KMEM_DESC "Kernel Malloc/Slab Tests"
34 #define SPLAT_KMEM_TEST1_ID 0x0101
35 #define SPLAT_KMEM_TEST1_NAME "kmem_alloc"
36 #define SPLAT_KMEM_TEST1_DESC "Memory allocation test (kmem_alloc)"
38 #define SPLAT_KMEM_TEST2_ID 0x0102
39 #define SPLAT_KMEM_TEST2_NAME "kmem_zalloc"
40 #define SPLAT_KMEM_TEST2_DESC "Memory allocation test (kmem_zalloc)"
42 #define SPLAT_KMEM_TEST3_ID 0x0103
43 #define SPLAT_KMEM_TEST3_NAME "vmem_alloc"
44 #define SPLAT_KMEM_TEST3_DESC "Memory allocation test (vmem_alloc)"
46 #define SPLAT_KMEM_TEST4_ID 0x0104
47 #define SPLAT_KMEM_TEST4_NAME "vmem_zalloc"
48 #define SPLAT_KMEM_TEST4_DESC "Memory allocation test (vmem_zalloc)"
50 #define SPLAT_KMEM_TEST5_ID 0x0105
51 #define SPLAT_KMEM_TEST5_NAME "slab_small"
52 #define SPLAT_KMEM_TEST5_DESC "Slab ctor/dtor test (small)"
54 #define SPLAT_KMEM_TEST6_ID 0x0106
55 #define SPLAT_KMEM_TEST6_NAME "slab_large"
56 #define SPLAT_KMEM_TEST6_DESC "Slab ctor/dtor test (large)"
58 #define SPLAT_KMEM_TEST7_ID 0x0107
59 #define SPLAT_KMEM_TEST7_NAME "slab_align"
60 #define SPLAT_KMEM_TEST7_DESC "Slab alignment test"
62 #define SPLAT_KMEM_TEST8_ID 0x0108
63 #define SPLAT_KMEM_TEST8_NAME "slab_reap"
64 #define SPLAT_KMEM_TEST8_DESC "Slab reaping test"
66 #define SPLAT_KMEM_TEST9_ID 0x0109
67 #define SPLAT_KMEM_TEST9_NAME "slab_age"
68 #define SPLAT_KMEM_TEST9_DESC "Slab aging test"
70 #define SPLAT_KMEM_TEST10_ID 0x010a
71 #define SPLAT_KMEM_TEST10_NAME "slab_lock"
72 #define SPLAT_KMEM_TEST10_DESC "Slab locking test"
75 #define SPLAT_KMEM_TEST11_ID 0x010b
76 #define SPLAT_KMEM_TEST11_NAME "slab_overcommit"
77 #define SPLAT_KMEM_TEST11_DESC "Slab memory overcommit test"
80 #define SPLAT_KMEM_TEST12_ID 0x010c
81 #define SPLAT_KMEM_TEST12_NAME "vmem_size"
82 #define SPLAT_KMEM_TEST12_DESC "Memory zone 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
<= (PAGE_SIZE
* 32))) {
102 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++) {
103 ptr
[i
] = kmem_alloc(size
, KM_SLEEP
| KM_NODEBUG
);
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
<= (PAGE_SIZE
* 32))) {
134 for (i
= 0; i
< SPLAT_KMEM_ALLOC_COUNT
; i
++) {
135 ptr
[i
] = kmem_zalloc(size
, KM_SLEEP
| KM_NODEBUG
);
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;
175 while ((!rc
) && (size
<= (PAGE_SIZE
* 1024))) {
178 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++) {
179 ptr
[i
] = vmem_alloc(size
, KM_SLEEP
);
184 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++)
186 vmem_free(ptr
[i
], size
);
188 splat_vprint(file
, SPLAT_KMEM_TEST3_NAME
,
189 "%d byte allocations, %d/%d successful\n",
190 size
, count
, SPLAT_VMEM_ALLOC_COUNT
);
191 if (count
!= SPLAT_VMEM_ALLOC_COUNT
)
201 splat_kmem_test4(struct file
*file
, void *arg
)
203 void *ptr
[SPLAT_VMEM_ALLOC_COUNT
];
204 int size
= PAGE_SIZE
;
205 int i
, j
, count
, rc
= 0;
207 while ((!rc
) && (size
<= (PAGE_SIZE
* 1024))) {
210 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++) {
211 ptr
[i
] = vmem_zalloc(size
, KM_SLEEP
);
216 /* Ensure buffer has been zero filled */
217 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++) {
218 for (j
= 0; j
< size
; j
++) {
219 if (((char *)ptr
[i
])[j
] != '\0') {
220 splat_vprint(file
, SPLAT_KMEM_TEST4_NAME
,
221 "%d-byte allocation was "
222 "not zeroed\n", size
);
228 for (i
= 0; i
< SPLAT_VMEM_ALLOC_COUNT
; i
++)
230 vmem_free(ptr
[i
], size
);
232 splat_vprint(file
, SPLAT_KMEM_TEST4_NAME
,
233 "%d byte allocations, %d/%d successful\n",
234 size
, count
, SPLAT_VMEM_ALLOC_COUNT
);
235 if (count
!= SPLAT_VMEM_ALLOC_COUNT
)
244 #define SPLAT_KMEM_TEST_MAGIC 0x004488CCUL
245 #define SPLAT_KMEM_CACHE_NAME "kmem_test"
246 #define SPLAT_KMEM_OBJ_COUNT 1024
247 #define SPLAT_KMEM_OBJ_RECLAIM 1000 /* objects */
248 #define SPLAT_KMEM_THREADS 32
250 #define KCP_FLAG_READY 0x01
252 typedef struct kmem_cache_data
{
253 unsigned long kcd_magic
;
254 struct list_head kcd_node
;
259 typedef struct kmem_cache_thread
{
262 struct list_head kct_list
;
263 } kmem_cache_thread_t
;
265 typedef struct kmem_cache_priv
{
266 unsigned long kcp_magic
;
267 struct file
*kcp_file
;
268 kmem_cache_t
*kcp_cache
;
270 wait_queue_head_t kcp_ctl_waitq
;
271 wait_queue_head_t kcp_thr_waitq
;
274 kmem_cache_thread_t
*kcp_kct
[SPLAT_KMEM_THREADS
];
282 static kmem_cache_priv_t
*
283 splat_kmem_cache_test_kcp_alloc(struct file
*file
, char *name
,
284 int size
, int align
, int alloc
)
286 kmem_cache_priv_t
*kcp
;
288 kcp
= kmem_zalloc(sizeof(kmem_cache_priv_t
), KM_SLEEP
);
292 kcp
->kcp_magic
= SPLAT_KMEM_TEST_MAGIC
;
293 kcp
->kcp_file
= file
;
294 kcp
->kcp_cache
= NULL
;
295 spin_lock_init(&kcp
->kcp_lock
);
296 init_waitqueue_head(&kcp
->kcp_ctl_waitq
);
297 init_waitqueue_head(&kcp
->kcp_thr_waitq
);
299 kcp
->kcp_kct_count
= -1;
300 kcp
->kcp_size
= size
;
301 kcp
->kcp_align
= align
;
303 kcp
->kcp_alloc
= alloc
;
310 splat_kmem_cache_test_kcp_free(kmem_cache_priv_t
*kcp
)
312 kmem_free(kcp
, sizeof(kmem_cache_priv_t
));
315 static kmem_cache_thread_t
*
316 splat_kmem_cache_test_kct_alloc(kmem_cache_priv_t
*kcp
, int id
)
318 kmem_cache_thread_t
*kct
;
320 ASSERTF(id
< SPLAT_KMEM_THREADS
, "id=%d\n", id
);
321 ASSERT(kcp
->kcp_kct
[id
] == NULL
);
323 kct
= kmem_zalloc(sizeof(kmem_cache_thread_t
), KM_SLEEP
);
327 spin_lock_init(&kct
->kct_lock
);
329 INIT_LIST_HEAD(&kct
->kct_list
);
331 spin_lock(&kcp
->kcp_lock
);
332 kcp
->kcp_kct
[id
] = kct
;
333 spin_unlock(&kcp
->kcp_lock
);
339 splat_kmem_cache_test_kct_free(kmem_cache_priv_t
*kcp
,
340 kmem_cache_thread_t
*kct
)
342 spin_lock(&kcp
->kcp_lock
);
343 kcp
->kcp_kct
[kct
->kct_id
] = NULL
;
344 spin_unlock(&kcp
->kcp_lock
);
346 kmem_free(kct
, sizeof(kmem_cache_thread_t
));
350 splat_kmem_cache_test_kcd_free(kmem_cache_priv_t
*kcp
,
351 kmem_cache_thread_t
*kct
)
353 kmem_cache_data_t
*kcd
;
355 spin_lock(&kct
->kct_lock
);
356 while (!list_empty(&kct
->kct_list
)) {
357 kcd
= list_entry(kct
->kct_list
.next
,
358 kmem_cache_data_t
, kcd_node
);
359 list_del(&kcd
->kcd_node
);
360 spin_unlock(&kct
->kct_lock
);
362 kmem_cache_free(kcp
->kcp_cache
, kcd
);
364 spin_lock(&kct
->kct_lock
);
366 spin_unlock(&kct
->kct_lock
);
370 splat_kmem_cache_test_kcd_alloc(kmem_cache_priv_t
*kcp
,
371 kmem_cache_thread_t
*kct
, int count
)
373 kmem_cache_data_t
*kcd
;
376 for (i
= 0; i
< count
; i
++) {
377 kcd
= kmem_cache_alloc(kcp
->kcp_cache
, KM_SLEEP
);
379 splat_kmem_cache_test_kcd_free(kcp
, kct
);
383 spin_lock(&kct
->kct_lock
);
384 list_add_tail(&kcd
->kcd_node
, &kct
->kct_list
);
385 spin_unlock(&kct
->kct_lock
);
392 splat_kmem_cache_test_debug(struct file
*file
, char *name
,
393 kmem_cache_priv_t
*kcp
)
397 splat_vprint(file
, name
,
398 "%s cache objects %d, slabs %u/%u objs %u/%u mags ",
399 kcp
->kcp_cache
->skc_name
, kcp
->kcp_count
,
400 (unsigned)kcp
->kcp_cache
->skc_slab_alloc
,
401 (unsigned)kcp
->kcp_cache
->skc_slab_total
,
402 (unsigned)kcp
->kcp_cache
->skc_obj_alloc
,
403 (unsigned)kcp
->kcp_cache
->skc_obj_total
);
405 for_each_online_cpu(j
)
406 splat_print(file
, "%u/%u ",
407 kcp
->kcp_cache
->skc_mag
[j
]->skm_avail
,
408 kcp
->kcp_cache
->skc_mag
[j
]->skm_size
);
410 splat_print(file
, "%s\n", "");
414 splat_kmem_cache_test_constructor(void *ptr
, void *priv
, int flags
)
416 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)priv
;
417 kmem_cache_data_t
*kcd
= (kmem_cache_data_t
*)ptr
;
420 kcd
->kcd_magic
= kcp
->kcp_magic
;
421 INIT_LIST_HEAD(&kcd
->kcd_node
);
423 memset(kcd
->kcd_buf
, 0xaa, kcp
->kcp_size
- (sizeof *kcd
));
431 splat_kmem_cache_test_destructor(void *ptr
, void *priv
)
433 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)priv
;
434 kmem_cache_data_t
*kcd
= (kmem_cache_data_t
*)ptr
;
439 memset(kcd
->kcd_buf
, 0xbb, kcp
->kcp_size
- (sizeof *kcd
));
447 * Generic reclaim function which assumes that all objects may
448 * be reclaimed at any time. We free a small percentage of the
449 * objects linked off the kcp or kct[] every time we are called.
452 splat_kmem_cache_test_reclaim(void *priv
)
454 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)priv
;
455 kmem_cache_thread_t
*kct
;
456 kmem_cache_data_t
*kcd
;
460 ASSERT(kcp
->kcp_magic
== SPLAT_KMEM_TEST_MAGIC
);
462 /* For each kct thread reclaim some objects */
463 spin_lock(&kcp
->kcp_lock
);
464 for (i
= 0; i
< SPLAT_KMEM_THREADS
; i
++) {
465 kct
= kcp
->kcp_kct
[i
];
469 spin_unlock(&kcp
->kcp_lock
);
470 spin_lock(&kct
->kct_lock
);
472 count
= SPLAT_KMEM_OBJ_RECLAIM
;
473 while (count
> 0 && !list_empty(&kct
->kct_list
)) {
474 kcd
= list_entry(kct
->kct_list
.next
,
475 kmem_cache_data_t
, kcd_node
);
476 list_del(&kcd
->kcd_node
);
477 list_add(&kcd
->kcd_node
, &reclaim
);
481 spin_unlock(&kct
->kct_lock
);
482 spin_lock(&kcp
->kcp_lock
);
484 spin_unlock(&kcp
->kcp_lock
);
486 /* Freed outside the spin lock */
487 while (!list_empty(&reclaim
)) {
488 kcd
= list_entry(reclaim
.next
, kmem_cache_data_t
, kcd_node
);
489 list_del(&kcd
->kcd_node
);
490 kmem_cache_free(kcp
->kcp_cache
, kcd
);
497 splat_kmem_cache_test_threads(kmem_cache_priv_t
*kcp
, int threads
)
501 spin_lock(&kcp
->kcp_lock
);
502 rc
= (kcp
->kcp_kct_count
== threads
);
503 spin_unlock(&kcp
->kcp_lock
);
509 splat_kmem_cache_test_flags(kmem_cache_priv_t
*kcp
, int flags
)
513 spin_lock(&kcp
->kcp_lock
);
514 rc
= (kcp
->kcp_flags
& flags
);
515 spin_unlock(&kcp
->kcp_lock
);
521 splat_kmem_cache_test_thread(void *arg
)
523 kmem_cache_priv_t
*kcp
= (kmem_cache_priv_t
*)arg
;
524 kmem_cache_thread_t
*kct
;
527 ASSERT(kcp
->kcp_magic
== SPLAT_KMEM_TEST_MAGIC
);
529 /* Assign thread ids */
530 spin_lock(&kcp
->kcp_lock
);
531 if (kcp
->kcp_kct_count
== -1)
532 kcp
->kcp_kct_count
= 0;
534 id
= kcp
->kcp_kct_count
;
535 kcp
->kcp_kct_count
++;
536 spin_unlock(&kcp
->kcp_lock
);
538 kct
= splat_kmem_cache_test_kct_alloc(kcp
, id
);
544 /* Wait for all threads to have started and report they are ready */
545 if (kcp
->kcp_kct_count
== SPLAT_KMEM_THREADS
)
546 wake_up(&kcp
->kcp_ctl_waitq
);
548 wait_event(kcp
->kcp_thr_waitq
,
549 splat_kmem_cache_test_flags(kcp
, KCP_FLAG_READY
));
551 /* Create and destroy objects */
552 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, kcp
->kcp_alloc
);
553 splat_kmem_cache_test_kcd_free(kcp
, kct
);
556 splat_kmem_cache_test_kct_free(kcp
, kct
);
558 spin_lock(&kcp
->kcp_lock
);
562 if ((--kcp
->kcp_kct_count
) == 0)
563 wake_up(&kcp
->kcp_ctl_waitq
);
565 spin_unlock(&kcp
->kcp_lock
);
571 splat_kmem_cache_test(struct file
*file
, void *arg
, char *name
,
572 int size
, int align
, int flags
)
574 kmem_cache_priv_t
*kcp
;
575 kmem_cache_data_t
*kcd
= NULL
;
578 kcp
= splat_kmem_cache_test_kcp_alloc(file
, name
, size
, align
, 0);
580 splat_vprint(file
, name
, "Unable to create '%s'\n", "kcp");
585 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
,
586 kcp
->kcp_size
, kcp
->kcp_align
,
587 splat_kmem_cache_test_constructor
,
588 splat_kmem_cache_test_destructor
,
589 NULL
, kcp
, NULL
, flags
);
590 if (!kcp
->kcp_cache
) {
591 splat_vprint(file
, name
,
592 "Unable to create '%s'\n",
593 SPLAT_KMEM_CACHE_NAME
);
598 kcd
= kmem_cache_alloc(kcp
->kcp_cache
, KM_SLEEP
);
600 splat_vprint(file
, name
,
601 "Unable to allocate from '%s'\n",
602 SPLAT_KMEM_CACHE_NAME
);
607 if (!kcd
->kcd_flag
) {
608 splat_vprint(file
, name
,
609 "Failed to run contructor for '%s'\n",
610 SPLAT_KMEM_CACHE_NAME
);
615 if (kcd
->kcd_magic
!= kcp
->kcp_magic
) {
616 splat_vprint(file
, name
,
617 "Failed to pass private data to constructor "
618 "for '%s'\n", SPLAT_KMEM_CACHE_NAME
);
623 max
= kcp
->kcp_count
;
624 kmem_cache_free(kcp
->kcp_cache
, kcd
);
626 /* Destroy the entire cache which will force destructors to
627 * run and we can verify one was called for every object */
628 kmem_cache_destroy(kcp
->kcp_cache
);
629 if (kcp
->kcp_count
) {
630 splat_vprint(file
, name
,
631 "Failed to run destructor on all slab objects "
632 "for '%s'\n", SPLAT_KMEM_CACHE_NAME
);
636 splat_kmem_cache_test_kcp_free(kcp
);
637 splat_vprint(file
, name
,
638 "Successfully ran ctors/dtors for %d elements in '%s'\n",
639 max
, SPLAT_KMEM_CACHE_NAME
);
645 kmem_cache_free(kcp
->kcp_cache
, kcd
);
648 kmem_cache_destroy(kcp
->kcp_cache
);
650 splat_kmem_cache_test_kcp_free(kcp
);
656 splat_kmem_cache_thread_test(struct file
*file
, void *arg
, char *name
,
657 int size
, int alloc
, int max_time
)
659 kmem_cache_priv_t
*kcp
;
661 struct timespec start
, stop
, delta
;
665 kcp
= splat_kmem_cache_test_kcp_alloc(file
, name
, size
, 0, alloc
);
667 splat_vprint(file
, name
, "Unable to create '%s'\n", "kcp");
671 (void)snprintf(cache_name
, 32, "%s-%d-%d",
672 SPLAT_KMEM_CACHE_NAME
, size
, alloc
);
674 kmem_cache_create(cache_name
, kcp
->kcp_size
, 0,
675 splat_kmem_cache_test_constructor
,
676 splat_kmem_cache_test_destructor
,
677 splat_kmem_cache_test_reclaim
,
679 if (!kcp
->kcp_cache
) {
680 splat_vprint(file
, name
, "Unable to create '%s'\n", cache_name
);
685 start
= current_kernel_time();
687 for (i
= 0; i
< SPLAT_KMEM_THREADS
; i
++) {
688 thr
= thread_create(NULL
, 0,
689 splat_kmem_cache_test_thread
,
690 kcp
, 0, &p0
, TS_RUN
, minclsyspri
);
697 /* Sleep until all threads have started, then set the ready
698 * flag and wake them all up for maximum concurrency. */
699 wait_event(kcp
->kcp_ctl_waitq
,
700 splat_kmem_cache_test_threads(kcp
, SPLAT_KMEM_THREADS
));
702 spin_lock(&kcp
->kcp_lock
);
703 kcp
->kcp_flags
|= KCP_FLAG_READY
;
704 spin_unlock(&kcp
->kcp_lock
);
705 wake_up_all(&kcp
->kcp_thr_waitq
);
707 /* Sleep until all thread have finished */
708 wait_event(kcp
->kcp_ctl_waitq
, splat_kmem_cache_test_threads(kcp
, 0));
710 stop
= current_kernel_time();
711 delta
= timespec_sub(stop
, start
);
713 splat_vprint(file
, name
,
715 "%lu/%lu/%lu\t%lu/%lu/%lu\n",
716 kcp
->kcp_cache
->skc_name
,
717 delta
.tv_sec
, delta
.tv_nsec
,
718 (unsigned long)kcp
->kcp_cache
->skc_slab_total
,
719 (unsigned long)kcp
->kcp_cache
->skc_slab_max
,
720 (unsigned long)(kcp
->kcp_alloc
*
722 SPL_KMEM_CACHE_OBJ_PER_SLAB
),
723 (unsigned long)kcp
->kcp_cache
->skc_obj_total
,
724 (unsigned long)kcp
->kcp_cache
->skc_obj_max
,
725 (unsigned long)(kcp
->kcp_alloc
*
726 SPLAT_KMEM_THREADS
));
728 if (delta
.tv_sec
>= max_time
)
731 if (!rc
&& kcp
->kcp_rc
)
735 kmem_cache_destroy(kcp
->kcp_cache
);
737 splat_kmem_cache_test_kcp_free(kcp
);
741 /* Validate small object cache behavior for dynamic/kmem/vmem caches */
743 splat_kmem_test5(struct file
*file
, void *arg
)
745 char *name
= SPLAT_KMEM_TEST5_NAME
;
748 rc
= splat_kmem_cache_test(file
, arg
, name
, 128, 0, 0);
752 rc
= splat_kmem_cache_test(file
, arg
, name
, 128, 0, KMC_KMEM
);
756 return splat_kmem_cache_test(file
, arg
, name
, 128, 0, KMC_VMEM
);
760 * Validate large object cache behavior for dynamic/kmem/vmem caches
763 splat_kmem_test6(struct file
*file
, void *arg
)
765 char *name
= SPLAT_KMEM_TEST6_NAME
;
768 rc
= splat_kmem_cache_test(file
, arg
, name
, 256*1024, 0, 0);
772 rc
= splat_kmem_cache_test(file
, arg
, name
, 64*1024, 0, KMC_KMEM
);
776 return splat_kmem_cache_test(file
, arg
, name
, 1024*1024, 0, KMC_VMEM
);
780 * Validate object alignment cache behavior for caches
783 splat_kmem_test7(struct file
*file
, void *arg
)
785 char *name
= SPLAT_KMEM_TEST7_NAME
;
788 for (i
= SPL_KMEM_CACHE_ALIGN
; i
<= PAGE_SIZE
; i
*= 2) {
789 rc
= splat_kmem_cache_test(file
, arg
, name
, 157, i
, 0);
798 * Validate kmem_cache_reap() by requesting the slab cache free any objects
799 * it can. For a few reasons this may not immediately result in more free
800 * memory even if objects are freed. First off, due to fragmentation we
801 * may not be able to reclaim any slabs. Secondly, even if we do we fully
802 * clear some slabs we will not want to immediately reclaim all of them
803 * because we may contend with cache allocations and thrash. What we want
804 * to see is the slab size decrease more gradually as it becomes clear they
805 * will not be needed. This should be achievable in less than a minute.
806 * If it takes longer than this something has gone wrong.
809 splat_kmem_test8(struct file
*file
, void *arg
)
811 kmem_cache_priv_t
*kcp
;
812 kmem_cache_thread_t
*kct
;
815 kcp
= splat_kmem_cache_test_kcp_alloc(file
, SPLAT_KMEM_TEST8_NAME
,
818 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
819 "Unable to create '%s'\n", "kcp");
825 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
, kcp
->kcp_size
, 0,
826 splat_kmem_cache_test_constructor
,
827 splat_kmem_cache_test_destructor
,
828 splat_kmem_cache_test_reclaim
,
830 if (!kcp
->kcp_cache
) {
831 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
832 "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME
);
837 kct
= splat_kmem_cache_test_kct_alloc(kcp
, 0);
839 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
840 "Unable to create '%s'\n", "kct");
845 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, SPLAT_KMEM_OBJ_COUNT
);
847 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
, "Unable to "
848 "allocate from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
852 for (i
= 0; i
< 60; i
++) {
853 kmem_cache_reap_now(kcp
->kcp_cache
);
854 splat_kmem_cache_test_debug(file
, SPLAT_KMEM_TEST8_NAME
, kcp
);
856 if (kcp
->kcp_cache
->skc_obj_total
== 0)
859 set_current_state(TASK_INTERRUPTIBLE
);
860 schedule_timeout(HZ
);
863 if (kcp
->kcp_cache
->skc_obj_total
== 0) {
864 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
865 "Successfully created %d objects "
866 "in cache %s and reclaimed them\n",
867 SPLAT_KMEM_OBJ_COUNT
, SPLAT_KMEM_CACHE_NAME
);
869 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
870 "Failed to reclaim %u/%d objects from cache %s\n",
871 (unsigned)kcp
->kcp_cache
->skc_obj_total
,
872 SPLAT_KMEM_OBJ_COUNT
, SPLAT_KMEM_CACHE_NAME
);
876 /* Cleanup our mess (for failure case of time expiring) */
877 splat_kmem_cache_test_kcd_free(kcp
, kct
);
879 splat_kmem_cache_test_kct_free(kcp
, kct
);
881 kmem_cache_destroy(kcp
->kcp_cache
);
883 splat_kmem_cache_test_kcp_free(kcp
);
888 /* Test cache aging, we have allocated a large number of objects thus
889 * creating a large number of slabs and then free'd them all. However,
890 * since there should be little memory pressure at the moment those
891 * slabs have not been freed. What we want to see is the slab size
892 * decrease gradually as it becomes clear they will not be be needed.
893 * This should be achievable in less than minute. If it takes longer
894 * than this something has gone wrong.
897 splat_kmem_test9(struct file
*file
, void *arg
)
899 kmem_cache_priv_t
*kcp
;
900 kmem_cache_thread_t
*kct
;
901 int i
, rc
= 0, count
= SPLAT_KMEM_OBJ_COUNT
* 128;
903 kcp
= splat_kmem_cache_test_kcp_alloc(file
, SPLAT_KMEM_TEST9_NAME
,
906 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
907 "Unable to create '%s'\n", "kcp");
913 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
, kcp
->kcp_size
, 0,
914 splat_kmem_cache_test_constructor
,
915 splat_kmem_cache_test_destructor
,
917 if (!kcp
->kcp_cache
) {
918 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
919 "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME
);
924 kct
= splat_kmem_cache_test_kct_alloc(kcp
, 0);
926 splat_vprint(file
, SPLAT_KMEM_TEST8_NAME
,
927 "Unable to create '%s'\n", "kct");
932 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, count
);
934 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
, "Unable to "
935 "allocate from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
939 splat_kmem_cache_test_kcd_free(kcp
, kct
);
941 for (i
= 0; i
< 60; i
++) {
942 splat_kmem_cache_test_debug(file
, SPLAT_KMEM_TEST9_NAME
, kcp
);
944 if (kcp
->kcp_cache
->skc_obj_total
== 0)
947 set_current_state(TASK_INTERRUPTIBLE
);
948 schedule_timeout(HZ
);
951 if (kcp
->kcp_cache
->skc_obj_total
== 0) {
952 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
953 "Successfully created %d objects "
954 "in cache %s and reclaimed them\n",
955 count
, SPLAT_KMEM_CACHE_NAME
);
957 splat_vprint(file
, SPLAT_KMEM_TEST9_NAME
,
958 "Failed to reclaim %u/%d objects from cache %s\n",
959 (unsigned)kcp
->kcp_cache
->skc_obj_total
, count
,
960 SPLAT_KMEM_CACHE_NAME
);
965 splat_kmem_cache_test_kct_free(kcp
, kct
);
967 kmem_cache_destroy(kcp
->kcp_cache
);
969 splat_kmem_cache_test_kcp_free(kcp
);
975 * This test creates N threads with a shared kmem cache. They then all
976 * concurrently allocate and free from the cache to stress the locking and
977 * concurrent cache performance. If any one test takes longer than 5
978 * seconds to complete it is treated as a failure and may indicate a
979 * performance regression. On my test system no one test takes more
980 * than 1 second to complete so a 5x slowdown likely a problem.
983 splat_kmem_test10(struct file
*file
, void *arg
)
985 uint64_t size
, alloc
, rc
= 0;
987 for (size
= 32; size
<= 1024*1024; size
*= 2) {
989 splat_vprint(file
, SPLAT_KMEM_TEST10_NAME
, "%-22s %s", "name",
990 "time (sec)\tslabs \tobjs \thash\n");
991 splat_vprint(file
, SPLAT_KMEM_TEST10_NAME
, "%-22s %s", "",
992 " \ttot/max/calc\ttot/max/calc\n");
994 for (alloc
= 1; alloc
<= 1024; alloc
*= 2) {
996 /* Skip tests which exceed available memory. We
997 * leverage availrmem here for some extra testing */
998 if (size
* alloc
* SPLAT_KMEM_THREADS
> availrmem
/ 2)
1001 rc
= splat_kmem_cache_thread_test(file
, arg
,
1002 SPLAT_KMEM_TEST10_NAME
, size
, alloc
, 5);
1013 * This test creates N threads with a shared kmem cache which overcommits
1014 * memory by 4x. This makes it impossible for the slab to satify the
1015 * thread requirements without having its reclaim hook run which will
1016 * free objects back for use. This behavior is triggered by the linum VM
1017 * detecting a low memory condition on the node and invoking the shrinkers.
1018 * This should allow all the threads to complete while avoiding deadlock
1019 * and for the most part out of memory events. This is very tough on the
1020 * system so it is possible the test app may get oom'ed. This particular
1021 * test has proven troublesome on 32-bit archs with limited virtual
1022 * address space so it only run on 64-bit systems.
1025 splat_kmem_test11(struct file
*file
, void *arg
)
1027 uint64_t size
, alloc
, rc
;
1030 alloc
= ((4 * physmem
* PAGE_SIZE
) / size
) / SPLAT_KMEM_THREADS
;
1032 splat_vprint(file
, SPLAT_KMEM_TEST11_NAME
, "%-22s %s", "name",
1033 "time (sec)\tslabs \tobjs \thash\n");
1034 splat_vprint(file
, SPLAT_KMEM_TEST11_NAME
, "%-22s %s", "",
1035 " \ttot/max/calc\ttot/max/calc\n");
1037 rc
= splat_kmem_cache_thread_test(file
, arg
,
1038 SPLAT_KMEM_TEST11_NAME
, size
, alloc
, 60);
1045 * Check vmem_size() behavior by acquiring the alloc/free/total vmem
1046 * space, then allocate a known buffer size from vmem space. We can
1047 * then check that vmem_size() values were updated properly with in
1048 * a fairly small tolerence. The tolerance is important because we
1049 * are not the only vmem consumer on the system. Other unrelated
1050 * allocations might occur during the small test window. The vmem
1051 * allocation itself may also add in a little extra private space to
1052 * the buffer. Finally, verify total space always remains unchanged.
1055 splat_kmem_test12(struct file
*file
, void *arg
)
1057 size_t alloc1
, free1
, total1
;
1058 size_t alloc2
, free2
, total2
;
1059 int size
= 8*1024*1024;
1062 alloc1
= vmem_size(NULL
, VMEM_ALLOC
);
1063 free1
= vmem_size(NULL
, VMEM_FREE
);
1064 total1
= vmem_size(NULL
, VMEM_ALLOC
| VMEM_FREE
);
1065 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Vmem alloc=%lu "
1066 "free=%lu total=%lu\n", (unsigned long)alloc1
,
1067 (unsigned long)free1
, (unsigned long)total1
);
1069 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Alloc %d bytes\n", size
);
1070 ptr
= vmem_alloc(size
, KM_SLEEP
);
1072 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
,
1073 "Failed to alloc %d bytes\n", size
);
1077 alloc2
= vmem_size(NULL
, VMEM_ALLOC
);
1078 free2
= vmem_size(NULL
, VMEM_FREE
);
1079 total2
= vmem_size(NULL
, VMEM_ALLOC
| VMEM_FREE
);
1080 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Vmem alloc=%lu "
1081 "free=%lu total=%lu\n", (unsigned long)alloc2
,
1082 (unsigned long)free2
, (unsigned long)total2
);
1084 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Free %d bytes\n", size
);
1085 vmem_free(ptr
, size
);
1086 if (alloc2
< (alloc1
+ size
- (size
/ 100)) ||
1087 alloc2
> (alloc1
+ size
+ (size
/ 100))) {
1088 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Failed "
1089 "VMEM_ALLOC size: %lu != %lu+%d (+/- 1%%)\n",
1090 (unsigned long)alloc2
,(unsigned long)alloc1
,size
);
1094 if (free2
< (free1
- size
- (size
/ 100)) ||
1095 free2
> (free1
- size
+ (size
/ 100))) {
1096 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Failed "
1097 "VMEM_FREE size: %lu != %lu-%d (+/- 1%%)\n",
1098 (unsigned long)free2
, (unsigned long)free1
, size
);
1102 if (total1
!= total2
) {
1103 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
, "Failed "
1104 "VMEM_ALLOC | VMEM_FREE not constant: "
1105 "%lu != %lu\n", (unsigned long)total2
,
1106 (unsigned long)total1
);
1110 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
,
1111 "VMEM_ALLOC within tolerance: ~%ld%% (%ld/%d)\n",
1112 (long)abs(alloc1
+ (long)size
- alloc2
) * 100 / (long)size
,
1113 (long)abs(alloc1
+ (long)size
- alloc2
), size
);
1114 splat_vprint(file
, SPLAT_KMEM_TEST12_NAME
,
1115 "VMEM_FREE within tolerance: ~%ld%% (%ld/%d)\n",
1116 (long)abs((free1
- (long)size
) - free2
) * 100 / (long)size
,
1117 (long)abs((free1
- (long)size
) - free2
), size
);
1122 typedef struct dummy_page
{
1123 struct list_head dp_list
;
1124 char dp_pad
[PAGE_SIZE
- sizeof(struct list_head
)];
1128 * This test is designed to verify that direct reclaim is functioning as
1129 * expected. We allocate a large number of objects thus creating a large
1130 * number of slabs. We then apply memory pressure and expect that the
1131 * direct reclaim path can easily recover those slabs. The registered
1132 * reclaim function will free the objects and the slab shrinker will call
1133 * it repeatedly until at least a single slab can be freed.
1135 * Note it may not be possible to reclaim every last slab via direct reclaim
1136 * without a failure because the shrinker_rwsem may be contended. For this
1137 * reason, quickly reclaiming 3/4 of the slabs is considered a success.
1139 * This should all be possible within 10 seconds. For reference, on a
1140 * system with 2G of memory this test takes roughly 0.2 seconds to run.
1141 * It may take longer on larger memory systems but should still easily
1142 * complete in the alloted 10 seconds.
1145 splat_kmem_test13(struct file
*file
, void *arg
)
1147 kmem_cache_priv_t
*kcp
;
1148 kmem_cache_thread_t
*kct
;
1150 struct list_head list
;
1151 struct timespec start
, delta
= { 0, 0 };
1152 int size
, count
, slabs
, fails
= 0;
1153 int i
, rc
= 0, max_time
= 10;
1156 count
= ((physmem
* PAGE_SIZE
) / 4 / size
);
1158 kcp
= splat_kmem_cache_test_kcp_alloc(file
, SPLAT_KMEM_TEST13_NAME
,
1161 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1162 "Unable to create '%s'\n", "kcp");
1168 kmem_cache_create(SPLAT_KMEM_CACHE_NAME
, kcp
->kcp_size
, 0,
1169 splat_kmem_cache_test_constructor
,
1170 splat_kmem_cache_test_destructor
,
1171 splat_kmem_cache_test_reclaim
,
1173 if (!kcp
->kcp_cache
) {
1174 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1175 "Unable to create '%s'\n", SPLAT_KMEM_CACHE_NAME
);
1180 kct
= splat_kmem_cache_test_kct_alloc(kcp
, 0);
1182 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1183 "Unable to create '%s'\n", "kct");
1188 rc
= splat_kmem_cache_test_kcd_alloc(kcp
, kct
, count
);
1190 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
, "Unable to "
1191 "allocate from '%s'\n", SPLAT_KMEM_CACHE_NAME
);
1196 slabs
= kcp
->kcp_cache
->skc_slab_total
;
1197 INIT_LIST_HEAD(&list
);
1198 start
= current_kernel_time();
1200 /* Apply memory pressure */
1201 while (kcp
->kcp_cache
->skc_slab_total
> (slabs
>> 2)) {
1203 if ((i
% 10000) == 0)
1204 splat_kmem_cache_test_debug(
1205 file
, SPLAT_KMEM_TEST13_NAME
, kcp
);
1207 delta
= timespec_sub(current_kernel_time(), start
);
1208 if (delta
.tv_sec
>= max_time
) {
1209 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1210 "Failed to reclaim 3/4 of cache in %ds, "
1211 "%u/%u slabs remain\n", max_time
,
1212 (unsigned)kcp
->kcp_cache
->skc_slab_total
,
1218 dp
= (dummy_page_t
*)__get_free_page(GFP_KERNEL
| __GFP_NORETRY
);
1221 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1222 "Failed (%d) to allocate page with %u "
1223 "slabs still in the cache\n", fails
,
1224 (unsigned)kcp
->kcp_cache
->skc_slab_total
);
1228 list_add(&dp
->dp_list
, &list
);
1233 splat_vprint(file
, SPLAT_KMEM_TEST13_NAME
,
1234 "Successfully created %u slabs and with %d alloc "
1235 "failures reclaimed 3/4 of them in %d.%03ds\n",
1237 (int)delta
.tv_sec
, (int)delta
.tv_nsec
/ 1000000);
1239 /* Release memory pressure pages */
1240 while (!list_empty(&list
)) {
1241 dp
= list_entry(list
.next
, dummy_page_t
, dp_list
);
1242 list_del_init(&dp
->dp_list
);
1243 free_page((unsigned long)dp
);
1246 /* Release remaining kmem cache objects */
1247 splat_kmem_cache_test_kcd_free(kcp
, kct
);
1249 splat_kmem_cache_test_kct_free(kcp
, kct
);
1251 kmem_cache_destroy(kcp
->kcp_cache
);
1253 splat_kmem_cache_test_kcp_free(kcp
);
1259 splat_kmem_init(void)
1261 splat_subsystem_t
*sub
;
1263 sub
= kmalloc(sizeof(*sub
), GFP_KERNEL
);
1267 memset(sub
, 0, sizeof(*sub
));
1268 strncpy(sub
->desc
.name
, SPLAT_KMEM_NAME
, SPLAT_NAME_SIZE
);
1269 strncpy(sub
->desc
.desc
, SPLAT_KMEM_DESC
, SPLAT_DESC_SIZE
);
1270 INIT_LIST_HEAD(&sub
->subsystem_list
);
1271 INIT_LIST_HEAD(&sub
->test_list
);
1272 spin_lock_init(&sub
->test_lock
);
1273 sub
->desc
.id
= SPLAT_SUBSYSTEM_KMEM
;
1275 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST1_NAME
, SPLAT_KMEM_TEST1_DESC
,
1276 SPLAT_KMEM_TEST1_ID
, splat_kmem_test1
);
1277 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST2_NAME
, SPLAT_KMEM_TEST2_DESC
,
1278 SPLAT_KMEM_TEST2_ID
, splat_kmem_test2
);
1279 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST3_NAME
, SPLAT_KMEM_TEST3_DESC
,
1280 SPLAT_KMEM_TEST3_ID
, splat_kmem_test3
);
1281 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST4_NAME
, SPLAT_KMEM_TEST4_DESC
,
1282 SPLAT_KMEM_TEST4_ID
, splat_kmem_test4
);
1283 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST5_NAME
, SPLAT_KMEM_TEST5_DESC
,
1284 SPLAT_KMEM_TEST5_ID
, splat_kmem_test5
);
1285 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST6_NAME
, SPLAT_KMEM_TEST6_DESC
,
1286 SPLAT_KMEM_TEST6_ID
, splat_kmem_test6
);
1287 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST7_NAME
, SPLAT_KMEM_TEST7_DESC
,
1288 SPLAT_KMEM_TEST7_ID
, splat_kmem_test7
);
1289 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST8_NAME
, SPLAT_KMEM_TEST8_DESC
,
1290 SPLAT_KMEM_TEST8_ID
, splat_kmem_test8
);
1291 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST9_NAME
, SPLAT_KMEM_TEST9_DESC
,
1292 SPLAT_KMEM_TEST9_ID
, splat_kmem_test9
);
1293 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST10_NAME
, SPLAT_KMEM_TEST10_DESC
,
1294 SPLAT_KMEM_TEST10_ID
, splat_kmem_test10
);
1296 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST11_NAME
, SPLAT_KMEM_TEST11_DESC
,
1297 SPLAT_KMEM_TEST11_ID
, splat_kmem_test11
);
1299 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST12_NAME
, SPLAT_KMEM_TEST12_DESC
,
1300 SPLAT_KMEM_TEST12_ID
, splat_kmem_test12
);
1301 SPLAT_TEST_INIT(sub
, SPLAT_KMEM_TEST13_NAME
, SPLAT_KMEM_TEST13_DESC
,
1302 SPLAT_KMEM_TEST13_ID
, splat_kmem_test13
);
1308 splat_kmem_fini(splat_subsystem_t
*sub
)
1311 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST13_ID
);
1312 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST12_ID
);
1314 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST11_ID
);
1316 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST10_ID
);
1317 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST9_ID
);
1318 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST8_ID
);
1319 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST7_ID
);
1320 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST6_ID
);
1321 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST5_ID
);
1322 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST4_ID
);
1323 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST3_ID
);
1324 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST2_ID
);
1325 SPLAT_TEST_FINI(sub
, SPLAT_KMEM_TEST1_ID
);
1331 splat_kmem_id(void) {
1332 return SPLAT_SUBSYSTEM_KMEM
;