slob_def.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __LINUX_SLOB_DEF_H
  2. #define __LINUX_SLOB_DEF_H
  3. #ifndef ARCH_KMALLOC_MINALIGN
  4. #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
  5. #endif
  6. #ifndef ARCH_SLAB_MINALIGN
  7. #define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
  8. #endif
  9. void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
  10. static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
  11. gfp_t flags)
  12. {
  13. return kmem_cache_alloc_node(cachep, flags, -1);
  14. }
  15. void *__kmalloc_node(size_t size, gfp_t flags, int node);
  16. static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
  17. {
  18. return __kmalloc_node(size, flags, node);
  19. }
  20. /**
  21. * kmalloc - allocate memory
  22. * @size: how many bytes of memory are required.
  23. * @flags: the type of memory to allocate (see kcalloc).
  24. *
  25. * kmalloc is the normal method of allocating memory
  26. * in the kernel.
  27. */
  28. static __always_inline void *kmalloc(size_t size, gfp_t flags)
  29. {
  30. return __kmalloc_node(size, flags, -1);
  31. }
  32. static __always_inline void *__kmalloc(size_t size, gfp_t flags)
  33. {
  34. return kmalloc(size, flags);
  35. }
  36. #endif /* __LINUX_SLOB_DEF_H */