diff options
author | avatar <avatar@FreeBSD.org> | 2005-07-01 15:21:30 +0000 |
---|---|---|
committer | avatar <avatar@FreeBSD.org> | 2005-07-01 15:21:30 +0000 |
commit | cd4bfad3f4ba5095161965b917d002ca6e2f0351 (patch) | |
tree | 147319ac765fa09f2f2ee982d5fabcc2832eae98 /sys/cam/cam_sim.c | |
parent | 7022c58ccbb4c7d5ef45d1d37b1d76e6d27c6e3b (diff) | |
download | FreeBSD-src-cd4bfad3f4ba5095161965b917d002ca6e2f0351.zip FreeBSD-src-cd4bfad3f4ba5095161965b917d002ca6e2f0351.tar.gz |
- Providing fine-grained malloc statistic by replacing M_DEVBUF with
module-specific malloc types. These should help us to pinpoint the
possible memory leakage in the future.
- Implementing xpt_alloc_ccb_nowait() and replacing all malloc/free based
CCB memory management with xpt_alloc_ccb[_nowait]/xpt_free_ccb. Hopefully
this would be helpful if someday we move the CCB allocator to use UMA
instead of malloc().
Encouraged by: jeffr, rwatson
Reviewed by: gibbs, scottl
Approved by: re (scottl)
Diffstat (limited to 'sys/cam/cam_sim.c')
-rw-r--r-- | sys/cam/cam_sim.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c index 28b16b6..322915f 100644 --- a/sys/cam/cam_sim.c +++ b/sys/cam/cam_sim.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> +#include <sys/kernel.h> #include <cam/cam.h> #include <cam/cam_ccb.h> @@ -40,6 +41,8 @@ __FBSDID("$FreeBSD$"); #define CAM_PATH_ANY (u_int32_t)-1 +MALLOC_DEFINE(M_CAMSIM, "CAM SIM", "CAM SIM buffers"); + struct cam_devq * cam_simq_alloc(u_int32_t max_sim_transactions) { @@ -68,10 +71,10 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, */ if (strcmp(sim_name, "xpt") == 0) sim = (struct cam_sim *)malloc(sizeof(struct cam_sim), - M_DEVBUF, M_WAITOK); + M_CAMSIM, M_WAITOK); else sim = (struct cam_sim *)malloc(sizeof(struct cam_sim), - M_DEVBUF, M_NOWAIT); + M_CAMSIM, M_NOWAIT); if (sim != NULL) { sim->sim_action = sim_action; @@ -96,7 +99,7 @@ cam_sim_free(struct cam_sim *sim, int free_devq) { if (free_devq) cam_simq_free(sim->devq); - free(sim, M_DEVBUF); + free(sim, M_CAMSIM); } void |