Deleted Added
full compact
opensolaris_kmem.c (219089) opensolaris_kmem.c (254025)
1/*-
2 * Copyright (c) 2006-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c 219089 2011-02-27 19:41:40Z pjd $");
28__FBSDID("$FreeBSD: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c 254025 2013-08-07 06:21:20Z jeff $");
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/systm.h>
33#include <sys/malloc.h>
34#include <sys/kmem.h>
35#include <sys/debug.h>
36#include <sys/mutex.h>

--- 20 unchanged lines hidden (view full) ---

57 struct stack stack;
58 LIST_ENTRY(kmem_item) next;
59};
60static LIST_HEAD(, kmem_item) kmem_items;
61static struct mtx kmem_items_mtx;
62MTX_SYSINIT(kmem_items_mtx, &kmem_items_mtx, "kmem_items", MTX_DEF);
63#endif /* KMEM_DEBUG */
64
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/systm.h>
33#include <sys/malloc.h>
34#include <sys/kmem.h>
35#include <sys/debug.h>
36#include <sys/mutex.h>

--- 20 unchanged lines hidden (view full) ---

57 struct stack stack;
58 LIST_ENTRY(kmem_item) next;
59};
60static LIST_HEAD(, kmem_item) kmem_items;
61static struct mtx kmem_items_mtx;
62MTX_SYSINIT(kmem_items_mtx, &kmem_items_mtx, "kmem_items", MTX_DEF);
63#endif /* KMEM_DEBUG */
64
65#include <sys/vmem.h>
66
65void *
66zfs_kmem_alloc(size_t size, int kmflags)
67{
68 void *p;
69#ifdef KMEM_DEBUG
70 struct kmem_item *i;
71
72 size += sizeof(struct kmem_item);

--- 57 unchanged lines hidden (view full) ---

130
131 return (kmem_size_val);
132}
133
134uint64_t
135kmem_used(void)
136{
137
67void *
68zfs_kmem_alloc(size_t size, int kmflags)
69{
70 void *p;
71#ifdef KMEM_DEBUG
72 struct kmem_item *i;
73
74 size += sizeof(struct kmem_item);

--- 57 unchanged lines hidden (view full) ---

132
133 return (kmem_size_val);
134}
135
136uint64_t
137kmem_used(void)
138{
139
138 return (kmem_map->size);
140 return (vmem_size(kmem_arena, VMEM_ALLOC));
139}
140
141static int
142kmem_std_constructor(void *mem, int size __unused, void *private, int flags)
143{
144 struct kmem_cache *cache = private;
145
146 return (cache->kc_constructor(mem, cache->kc_private, flags));

--- 133 unchanged lines hidden ---
141}
142
143static int
144kmem_std_constructor(void *mem, int size __unused, void *private, int flags)
145{
146 struct kmem_cache *cache = private;
147
148 return (cache->kc_constructor(mem, cache->kc_private, flags));

--- 133 unchanged lines hidden ---