#define MEM_MAGIC 0xc11cf77f
#define MEM_FENCE_SIZE 32
-enum _stp_memtype { MEM_KMALLOC, MEM_VMALLOC, MEM_PERCPU };
+enum _stp_memtype { MEM_KMALLOC, MEM_PERCPU };
typedef struct {
char *alloc;
static const _stp_malloc_type const _stp_malloc_types[] = {
{"kmalloc", "kfree"},
- {"vmalloc", "vfree"},
{"alloc_percpu", "free_percpu"}
};
free_percpu(addr);
kfree(p);
break;
- case MEM_VMALLOC:
- _stp_check_mem_fence(addr, m->len);
- vfree(addr - MEM_FENCE_SIZE);
- break;
default:
printk("SYSTEMTAP ERROR: Attempted to free memory at addr %p len=%d with unknown allocation type.\n", addr, (int)m->len);
}
case MEM_PERCPU:
/* do nothing */
break;
- case MEM_VMALLOC:
- _stp_check_mem_fence(addr, m->len);
- break;
default:
printk("SYSTEMTAP ERROR: Attempted to validate memory at addr %p len=%d with unknown allocation type.\n", addr, (int)m->len);
}
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) */
-static void *_stp_vmalloc(unsigned long size)
-{
- void *ret;
-#ifdef STP_MAXMEMORY
- if ((_STP_MODULE_CORE_SIZE + _stp_allocated_memory + size)
- > (STP_MAXMEMORY * 1024)) {
- return NULL;
- }
-#endif
-#ifdef DEBUG_MEM
- ret = __vmalloc(size + MEM_DEBUG_SIZE, STP_ALLOC_FLAGS, PAGE_KERNEL);
- if (likely(ret)) {
- _stp_allocated_memory += size;
- ret = _stp_mem_debug_setup(ret, size, MEM_VMALLOC);
- }
-#else
- ret = __vmalloc(size, STP_ALLOC_FLAGS, PAGE_KERNEL);
- if (likely(ret)) {
- _stp_allocated_memory += size;
- }
-#endif
- return ret;
-}
-
#ifdef PCPU_MIN_UNIT_SIZE
#define _STP_MAX_PERCPU_SIZE PCPU_MIN_UNIT_SIZE
#else
#endif
}
-static void _stp_vfree(void *addr)
-{
-#ifdef DEBUG_MEM
- _stp_mem_debug_free(addr, MEM_VMALLOC);
-#else
- vfree(addr);
-#endif
-}
-
static void _stp_free_percpu(void *addr)
{
#ifdef DEBUG_MEM
free_percpu(m->addr);
kfree(p);
break;
- case MEM_VMALLOC:
- _stp_check_mem_fence(m->addr, m->len);
- vfree(m->addr - MEM_FENCE_SIZE);
- break;
default:
printk("SYSTEMTAP ERROR: Attempted to free memory at addr %p len=%d with unknown allocation type.\n", m->addr, (int)m->len);
}