Lines Matching defs:pack

866  * BPF program pack allocator.
870 * to instruction TLB. To solve this issue, we introduce a BPF program pack
894 * pack allocator test "is a predictor flush wired up at all" with a cheap
927 struct bpf_prog_pack *pack;
930 pack = kzalloc_flex(*pack, bitmap, BITS_TO_LONGS(BPF_PROG_CHUNK_COUNT));
931 if (!pack)
933 pack->ptr = bpf_jit_alloc_exec(BPF_PROG_PACK_SIZE);
934 if (!pack->ptr)
936 bitmap_zero(pack->bitmap, BPF_PROG_PACK_SIZE / BPF_PROG_CHUNK_SIZE);
939 pack->arch_flush_needed = true;
941 bpf_fill_ill_insns(pack->ptr, BPF_PROG_PACK_SIZE);
942 set_vm_flush_reset_perms(pack->ptr);
943 err = set_memory_rox((unsigned long)pack->ptr,
948 list_add_tail(&pack->list, &pack_list);
949 return pack;
952 bpf_jit_free_exec(pack->ptr);
953 kfree(pack);
960 struct bpf_prog_pack *pack, *fallback_pack = NULL;
967 * Allocations larger than a pack get their own pages, and
970 * are bounded well below a pack size.
990 list_for_each_entry(pack, &pack_list, list) {
991 pos = bitmap_find_next_zero_area(pack->bitmap, BPF_PROG_CHUNK_COUNT, 0,
995 /* Flush not enabled, use any pack */
999 * cBPF reuse of a dirty pack triggers a flush, so prefer a
1000 * clean pack for cBPF. eBPF never flushes, so steer it to a
1001 * dirty pack and keep clean packs free for cBPF.
1003 if (was_classic ^ pack->arch_flush_needed)
1006 fallback_pack = pack;
1011 /* No preferred pack found */
1013 pack = fallback_pack;
1018 pack = alloc_new_pack(bpf_fill_ill_insns);
1019 if (!pack)
1027 pack->arch_flush_needed &&
1035 bitmap_set(pack->bitmap, pos, nbits);
1036 ptr = (void *)(pack->ptr) + (pos << BPF_PROG_CHUNK_SHIFT);
1045 struct bpf_prog_pack *pack = NULL, *tmp;
1057 pack = tmp;
1062 if (WARN_ONCE(!pack, "bpf_prog_pack bug\n"))
1066 pos = ((unsigned long)ptr - (unsigned long)pack->ptr) >> BPF_PROG_CHUNK_SHIFT;
1071 bitmap_clear(pack->bitmap, pos, nbits);
1074 pack->arch_flush_needed = true;
1075 if (bitmap_find_next_zero_area(pack->bitmap, BPF_PROG_CHUNK_COUNT, 0,
1077 list_del(&pack->list);
1078 bpf_jit_free_exec(pack->ptr);
1079 kfree(pack);