static void vperfctr_free(struct vperfctr *perfctr) { debug_free(perfctr); ClearPageReserved(virt_to_page(perfctr)); free_page((unsigned long)perfctr); dec_nrctrs(); }
/* Allocate a `struct vperfctr'. Claim and reserve an entire page so that it can be mmap():ed. */ static struct vperfctr *vperfctr_alloc(void) { unsigned long page; if (inc_nrctrs() != 0) return ERR_PTR(-EBUSY); page = get_zeroed_page(GFP_KERNEL); if (!page) { dec_nrctrs(); return ERR_PTR(-ENOMEM); } SetPageReserved(virt_to_page((void *)(page))); return (struct vperfctr*) page; }
/* Allocate a `struct vperfctr'. Claim and reserve an entire page so that it can be mmap():ed. */ static struct vperfctr *vperfctr_alloc(void) { struct vperfctr *perf; if (inc_nrctrs() != 0) return ERR_PTR(-EBUSY); perf = (struct vperfctr *) kmem_alloc (sizeof (struct vperfctr)); if (!perf) { dec_nrctrs(); return ERR_PTR(-ENOMEM); } return perf; }
static void vperfctr_free(struct vperfctr *perfctr) { kmem_free(perfctr); dec_nrctrs(); }