- kip->slot_used[idx] = SLOT_CLEAN;
- kip->nused--;
- DBPRINTF("collect_one_slot: nused=%d", kip->nused);
- if (kip->nused == 0)
- {
- /*
- * Page is no longer in use. Free it unless
- * it's the last one. We keep the last one
- * so as not to have to set it up again the
- * next time somebody inserts a probe.
- */
- hlist_del_rcu(&kip->hlist);
- if (!task && hlist_empty (page_list))
- {
- INIT_HLIST_NODE (&kip->hlist);
- hlist_add_head_rcu(&kip->hlist, page_list);
- }
- else
- {
- if(task){
- //E. G.: This code provides kernel dump because of rescheduling while atomic.
- //As workaround, this code was commented. In this case we will have memory leaks
- //for instrumented process, but instrumentation process should functionate correctly.
- //Planned that good solution for this problem will be done during redesigning KProbe
- //for improving supportability and performance.
-#if 0
- //printk("collect_one_slot %p/%d\n", task, task->pid);
- mm = get_task_mm (task);
- if (mm){
- down_write (&mm->mmap_sem);
- do_munmap(mm, (unsigned long)(kip->insns), PAGE_SIZE);
- up_write (&mm->mmap_sem);
- mmput(mm);
- }
-#endif
- kip->insns = NULL; //workaround
- kip->tgid = 0;
- }
- else {
- kfree(kip->insns);
- }
- kfree (kip->slot_used);
- kfree (kip);
- }
- return 1;
- }
- return 0;