Lines Matching defs:smap

45 static int prealloc_elems_and_freelist(struct bpf_stack_map *smap)
48 (u64)smap->map.value_size;
51 smap->elems = bpf_map_area_alloc(elem_size * smap->map.max_entries,
52 smap->map.numa_node);
53 if (!smap->elems)
56 err = pcpu_freelist_init(&smap->freelist);
60 pcpu_freelist_populate(&smap->freelist, smap->elems, elem_size,
61 smap->map.max_entries);
65 bpf_map_area_free(smap->elems);
73 struct bpf_stack_map *smap;
102 cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
103 smap = bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr));
104 if (!smap)
107 bpf_map_init_from_attr(&smap->map, attr);
108 smap->n_buckets = n_buckets;
114 err = prealloc_elems_and_freelist(smap);
118 return &smap->map;
123 bpf_map_area_free(smap);
230 struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);
246 id = hash & (smap->n_buckets - 1);
247 bucket = READ_ONCE(smap->buckets[id]);
259 pcpu_freelist_pop(&smap->freelist);
270 pcpu_freelist_push(&smap->freelist, &new_bucket->fnode);
274 pcpu_freelist_push(&smap->freelist, &new_bucket->fnode);
285 pcpu_freelist_pop(&smap->freelist);
294 old_bucket = xchg(&smap->buckets[id], new_bucket);
296 pcpu_freelist_push(&smap->freelist, &old_bucket->fnode);
659 struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);
663 if (unlikely(id >= smap->n_buckets))
666 bucket = xchg(&smap->buckets[id], NULL);
677 old_bucket = xchg(&smap->buckets[id], bucket);
679 pcpu_freelist_push(&smap->freelist, &old_bucket->fnode);
686 struct bpf_stack_map *smap = container_of(map,
696 if (id >= smap->n_buckets || !smap->buckets[id])
702 while (id < smap->n_buckets && !smap->buckets[id])
705 if (id >= smap->n_buckets)
721 struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);
725 if (unlikely(id >= smap->n_buckets))
728 old_bucket = xchg(&smap->buckets[id], NULL);
730 pcpu_freelist_push(&smap->freelist, &old_bucket->fnode);
740 struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);
742 bpf_map_area_free(smap->elems);
743 pcpu_freelist_destroy(&smap->freelist);
744 bpf_map_area_free(smap);
750 struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map);
752 u64 n_buckets = smap->n_buckets;
754 u64 usage = sizeof(*smap);