Lines Matching refs:c
103 static int slots_per_page(struct kprobe_insn_cache *c) in slots_per_page() argument
105 return PAGE_SIZE/(c->insn_size * sizeof(kprobe_opcode_t)); in slots_per_page()
133 static int collect_garbage_slots(struct kprobe_insn_cache *c);
139 kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c) in __get_insn_slot() argument
145 mutex_lock(&c->mutex); in __get_insn_slot()
148 list_for_each_entry_rcu(kip, &c->pages, list) { in __get_insn_slot()
149 if (kip->nused < slots_per_page(c)) { in __get_insn_slot()
151 for (i = 0; i < slots_per_page(c); i++) { in __get_insn_slot()
155 slot = kip->insns + (i * c->insn_size); in __get_insn_slot()
161 kip->nused = slots_per_page(c); in __get_insn_slot()
168 if (c->nr_garbage && collect_garbage_slots(c) == 0) in __get_insn_slot()
172 kip = kmalloc(KPROBE_INSN_PAGE_SIZE(slots_per_page(c)), GFP_KERNEL); in __get_insn_slot()
181 kip->insns = c->alloc(); in __get_insn_slot()
187 memset(kip->slot_used, SLOT_CLEAN, slots_per_page(c)); in __get_insn_slot()
191 kip->cache = c; in __get_insn_slot()
192 list_add_rcu(&kip->list, &c->pages); in __get_insn_slot()
197 PAGE_SIZE, false, c->sym); in __get_insn_slot()
199 mutex_unlock(&c->mutex); in __get_insn_slot()
233 static int collect_garbage_slots(struct kprobe_insn_cache *c) in collect_garbage_slots() argument
240 list_for_each_entry_safe(kip, next, &c->pages, list) { in collect_garbage_slots()
245 for (i = 0; i < slots_per_page(c); i++) { in collect_garbage_slots()
250 c->nr_garbage = 0; in collect_garbage_slots()
254 void __free_insn_slot(struct kprobe_insn_cache *c, in __free_insn_slot() argument
260 mutex_lock(&c->mutex); in __free_insn_slot()
262 list_for_each_entry_rcu(kip, &c->pages, list) { in __free_insn_slot()
264 (c->insn_size * sizeof(kprobe_opcode_t)); in __free_insn_slot()
265 if (idx >= 0 && idx < slots_per_page(c)) in __free_insn_slot()
280 if (++c->nr_garbage > slots_per_page(c)) in __free_insn_slot()
281 collect_garbage_slots(c); in __free_insn_slot()
286 mutex_unlock(&c->mutex); in __free_insn_slot()
294 bool __is_insn_slot_addr(struct kprobe_insn_cache *c, unsigned long addr) in __is_insn_slot_addr() argument
300 list_for_each_entry_rcu(kip, &c->pages, list) { in __is_insn_slot_addr()
312 int kprobe_cache_get_kallsym(struct kprobe_insn_cache *c, unsigned int *symnum, in kprobe_cache_get_kallsym() argument
319 list_for_each_entry_rcu(kip, &c->pages, list) { in kprobe_cache_get_kallsym()
322 strlcpy(sym, c->sym, KSYM_NAME_LEN); in kprobe_cache_get_kallsym()