diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-30 17:40:25 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-30 17:40:37 -0400 |
commit | e240b4ae86adb022e3266220ce9807dad8b51beb (patch) | |
tree | 535081dc65b75f8f288f10b820eeebbd64f9e0e0 /include/linux/vmalloc.h | |
parent | 59abea577659ce82ff0098633caaf74076a9b4d7 (diff) |
Update bcachefs sources to f638850417 bcachefs: bch2_trans_log_msg()
Diffstat (limited to 'include/linux/vmalloc.h')
-rw-r--r-- | include/linux/vmalloc.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 965e341d..55fffb59 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -1,59 +1,6 @@ #ifndef __TOOLS_LINUX_VMALLOC_H #define __TOOLS_LINUX_VMALLOC_H -#include <stdlib.h> -#include <sys/mman.h> - #include "linux/slab.h" -#include "tools-util.h" - -#define PAGE_KERNEL 0 -#define PAGE_KERNEL_EXEC 1 - -#define vfree(p) free(p) - -static inline void *__vmalloc(unsigned long size, gfp_t gfp_mask) -{ - unsigned i = 0; - void *p; - - size = round_up(size, PAGE_SIZE); - - do { - run_shrinkers(gfp_mask, i != 0); - - p = aligned_alloc(PAGE_SIZE, size); - if (p && gfp_mask & __GFP_ZERO) - memset(p, 0, size); - } while (!p && i++ < 10); - - return p; -} - -static inline void *vmalloc_exec(unsigned long size, gfp_t gfp_mask) -{ - void *p; - - p = __vmalloc(size, gfp_mask); - if (!p) - return NULL; - - if (mprotect(p, size, PROT_READ|PROT_WRITE|PROT_EXEC)) { - vfree(p); - return NULL; - } - - return p; -} - -static inline void *vmalloc(unsigned long size) -{ - return __vmalloc(size, GFP_KERNEL); -} - -static inline void *vzalloc(unsigned long size) -{ - return __vmalloc(size, GFP_KERNEL|__GFP_ZERO); -} #endif /* __TOOLS_LINUX_VMALLOC_H */ |