Lines Matching full:ma

512 int bpf_mem_alloc_init(struct bpf_mem_alloc *ma, int size, bool percpu)  in bpf_mem_alloc_init()  argument
525 ma->percpu = percpu; in bpf_mem_alloc_init()
540 ma->objcg = objcg; in bpf_mem_alloc_init()
551 ma->cache = pc; in bpf_mem_alloc_init()
561 ma->objcg = objcg; in bpf_mem_alloc_init()
576 ma->caches = pcc; in bpf_mem_alloc_init()
580 int bpf_mem_alloc_percpu_init(struct bpf_mem_alloc *ma, struct obj_cgroup *objcg) in bpf_mem_alloc_percpu_init() argument
588 ma->caches = pcc; in bpf_mem_alloc_percpu_init()
589 ma->objcg = objcg; in bpf_mem_alloc_percpu_init()
590 ma->percpu = true; in bpf_mem_alloc_percpu_init()
594 int bpf_mem_alloc_percpu_unit_init(struct bpf_mem_alloc *ma, int size) in bpf_mem_alloc_percpu_unit_init() argument
609 objcg = ma->objcg; in bpf_mem_alloc_percpu_unit_init()
610 pcc = ma->caches; in bpf_mem_alloc_percpu_unit_init()
661 static void check_leaked_objs(struct bpf_mem_alloc *ma) in check_leaked_objs() argument
667 if (ma->cache) { in check_leaked_objs()
669 c = per_cpu_ptr(ma->cache, cpu); in check_leaked_objs()
673 if (ma->caches) { in check_leaked_objs()
675 cc = per_cpu_ptr(ma->caches, cpu); in check_leaked_objs()
684 static void free_mem_alloc_no_barrier(struct bpf_mem_alloc *ma) in free_mem_alloc_no_barrier() argument
686 check_leaked_objs(ma); in free_mem_alloc_no_barrier()
687 free_percpu(ma->cache); in free_mem_alloc_no_barrier()
688 free_percpu(ma->caches); in free_mem_alloc_no_barrier()
689 ma->cache = NULL; in free_mem_alloc_no_barrier()
690 ma->caches = NULL; in free_mem_alloc_no_barrier()
693 static void free_mem_alloc(struct bpf_mem_alloc *ma) in free_mem_alloc() argument
709 free_mem_alloc_no_barrier(ma); in free_mem_alloc()
714 struct bpf_mem_alloc *ma = container_of(work, struct bpf_mem_alloc, work); in free_mem_alloc_deferred() local
716 free_mem_alloc(ma); in free_mem_alloc_deferred()
717 kfree(ma); in free_mem_alloc_deferred()
720 static void destroy_mem_alloc(struct bpf_mem_alloc *ma, int rcu_in_progress) in destroy_mem_alloc() argument
728 free_mem_alloc_no_barrier(ma); in destroy_mem_alloc()
732 copy = kmemdup(ma, sizeof(*ma), GFP_KERNEL); in destroy_mem_alloc()
735 free_mem_alloc(ma); in destroy_mem_alloc()
740 memset(ma, 0, sizeof(*ma)); in destroy_mem_alloc()
745 void bpf_mem_alloc_destroy(struct bpf_mem_alloc *ma) in bpf_mem_alloc_destroy() argument
751 if (ma->cache) { in bpf_mem_alloc_destroy()
754 c = per_cpu_ptr(ma->cache, cpu); in bpf_mem_alloc_destroy()
761 obj_cgroup_put(ma->objcg); in bpf_mem_alloc_destroy()
762 destroy_mem_alloc(ma, rcu_in_progress); in bpf_mem_alloc_destroy()
764 if (ma->caches) { in bpf_mem_alloc_destroy()
767 cc = per_cpu_ptr(ma->caches, cpu); in bpf_mem_alloc_destroy()
777 obj_cgroup_put(ma->objcg); in bpf_mem_alloc_destroy()
778 destroy_mem_alloc(ma, rcu_in_progress); in bpf_mem_alloc_destroy()
892 void notrace *bpf_mem_alloc(struct bpf_mem_alloc *ma, size_t size) in bpf_mem_alloc() argument
900 if (!ma->percpu) in bpf_mem_alloc()
906 ret = unit_alloc(this_cpu_ptr(ma->caches)->cache + idx); in bpf_mem_alloc()
910 void notrace bpf_mem_free(struct bpf_mem_alloc *ma, void *ptr) in bpf_mem_free() argument
923 unit_free(this_cpu_ptr(ma->caches)->cache + idx, ptr); in bpf_mem_free()
926 void notrace bpf_mem_free_rcu(struct bpf_mem_alloc *ma, void *ptr) in bpf_mem_free_rcu() argument
939 unit_free_rcu(this_cpu_ptr(ma->caches)->cache + idx, ptr); in bpf_mem_free_rcu()
942 void notrace *bpf_mem_cache_alloc(struct bpf_mem_alloc *ma) in bpf_mem_cache_alloc() argument
946 ret = unit_alloc(this_cpu_ptr(ma->cache)); in bpf_mem_cache_alloc()
950 void notrace bpf_mem_cache_free(struct bpf_mem_alloc *ma, void *ptr) in bpf_mem_cache_free() argument
955 unit_free(this_cpu_ptr(ma->cache), ptr); in bpf_mem_cache_free()
958 void notrace bpf_mem_cache_free_rcu(struct bpf_mem_alloc *ma, void *ptr) in bpf_mem_cache_free_rcu() argument
963 unit_free_rcu(this_cpu_ptr(ma->cache), ptr); in bpf_mem_cache_free_rcu()
988 void notrace *bpf_mem_cache_alloc_flags(struct bpf_mem_alloc *ma, gfp_t flags) in bpf_mem_cache_alloc_flags() argument
993 c = this_cpu_ptr(ma->cache); in bpf_mem_cache_alloc_flags()