slab.h (78d7441913524cfa5ff3a63b6c0f3a018ad0fead) slab.h (782a90d16af6b235ea51160defcf489fcb5f92a1)
1/*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

74struct linux_kmem_cache {
75 uma_zone_t cache_zone;
76 linux_kmem_ctor_t *cache_ctor;
77 unsigned cache_flags;
78 unsigned cache_size;
79};
80
81#define SLAB_HWCACHE_ALIGN (1 << 0)
1/*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

74struct linux_kmem_cache {
75 uma_zone_t cache_zone;
76 linux_kmem_ctor_t *cache_ctor;
77 unsigned cache_flags;
78 unsigned cache_size;
79};
80
81#define SLAB_HWCACHE_ALIGN (1 << 0)
82#define SLAB_DESTROY_BY_RCU (1 << 1)
82#define SLAB_TYPESAFE_BY_RCU (1 << 1)
83#define SLAB_RECLAIM_ACCOUNT (1 << 2)
84
85static inline gfp_t
86linux_check_m_flags(gfp_t flags)
87{
88 const gfp_t m = M_NOWAIT | M_WAITOK;
89
90 /* make sure either M_NOWAIT or M_WAITOK is set */

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

157 linux_check_m_flags(flags | M_ZERO)));
158}
159
160extern void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *);
161
162static inline void
163linux_kmem_cache_free(struct linux_kmem_cache *c, void *m)
164{
83#define SLAB_RECLAIM_ACCOUNT (1 << 2)
84
85static inline gfp_t
86linux_check_m_flags(gfp_t flags)
87{
88 const gfp_t m = M_NOWAIT | M_WAITOK;
89
90 /* make sure either M_NOWAIT or M_WAITOK is set */

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

157 linux_check_m_flags(flags | M_ZERO)));
158}
159
160extern void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *);
161
162static inline void
163linux_kmem_cache_free(struct linux_kmem_cache *c, void *m)
164{
165 if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU))
165 if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU))
166 linux_kmem_cache_free_rcu(c, m);
167 else
168 uma_zfree(c->cache_zone, m);
169}
170
171extern void linux_kmem_cache_destroy(struct linux_kmem_cache *);
172
173#endif /* _LINUX_SLAB_H_ */
166 linux_kmem_cache_free_rcu(c, m);
167 else
168 uma_zfree(c->cache_zone, m);
169}
170
171extern void linux_kmem_cache_destroy(struct linux_kmem_cache *);
172
173#endif /* _LINUX_SLAB_H_ */