mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Lots of fixes here:
- Detailed kmem memory allocation tracking. We can now get on spl module unload a list of all memory allocations which were not free'd and where the original alloc was. E.g. SPL: 15554:632:(spl-kmem.c:442:kmem_fini()) kmem leaked 90/319332 bytes SPL: 15554:648:(spl-kmem.c:451:kmem_fini()) address size data func:line SPL: 15554:648:(spl-kmem.c:457:kmem_fini()) ffff8100734b68b8 32 0100000001005a5a __spl_mutex_init:70 SPL: 15554:648:(spl-kmem.c:457:kmem_fini()) ffff8100734b6148 13 &tl->tl_lock __spl_mutex_init:74 SPL: 15554:648:(spl-kmem.c:457:kmem_fini()) ffff81007ac43730 32 0100000001005a5a __spl_mutex_init:70 SPL: 15554:648:(spl-kmem.c:457:kmem_fini()) ffff81007ac437d8 13 &tl->tl_lock __spl_mutex_init:74 - Shift to using rwsems in kmem implmentation, to simply locking and improve concurency. - Shift to using rwsems in mutex implementation, additionally ensure we never sleep in the init function if non-zero preempt_count or interrupts are disabled as can happen in a slab cache ctor/dtor. - Other minor formating fixes and such. TODO: - Finish the vmem memory allocation tracking - Vet all other SPL primatives for potential sleeping during *_init. I suspect the rwlock implemenation does this and should be fixes just like the mutex implemenation. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@95 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
@@ -138,7 +138,7 @@ typedef struct splat_info {
|
||||
#define sym2str(sym) (char *)(#sym)
|
||||
|
||||
#define splat_print(file, format, args...) \
|
||||
({ splat_info_t *_info_ = (splat_info_t *)file->private_data; \
|
||||
({ splat_info_t *_info_ = (splat_info_t *)file->private_data; \
|
||||
int _rc_; \
|
||||
\
|
||||
ASSERT(_info_); \
|
||||
@@ -160,7 +160,7 @@ typedef struct splat_info {
|
||||
_rc_; \
|
||||
})
|
||||
|
||||
#define splat_vprint(file, test, format, args...) \
|
||||
#define splat_vprint(file, test, format, args...) \
|
||||
splat_print(file, "%*s: " format, SPLAT_NAME_SIZE, test, args)
|
||||
|
||||
splat_subsystem_t * splat_condvar_init(void);
|
||||
|
||||
@@ -148,7 +148,7 @@ splat_kmem_test34_constructor(void *ptr, void *priv, int flags)
|
||||
kcd->kcd_flag = 1;
|
||||
|
||||
if (kcp) {
|
||||
kcd->kcd_magic = kcp->kcp_magic;
|
||||
kcd->kcd_magic = kcp->kcp_magic;
|
||||
kcp->kcp_count++;
|
||||
}
|
||||
}
|
||||
@@ -258,8 +258,8 @@ splat_kmem_test4_reclaim(void *priv)
|
||||
int i;
|
||||
|
||||
splat_vprint(kcp->kcp_file, SPLAT_KMEM_TEST4_NAME,
|
||||
"Reaping %d objects from '%s'\n",
|
||||
SPLAT_KMEM_OBJ_RECLAIM, SPLAT_KMEM_CACHE_NAME);
|
||||
"Reaping %d objects from '%s'\n",
|
||||
SPLAT_KMEM_OBJ_RECLAIM, SPLAT_KMEM_CACHE_NAME);
|
||||
for (i = 0; i < SPLAT_KMEM_OBJ_RECLAIM; i++) {
|
||||
if (kcp->kcp_kcd[i]) {
|
||||
kmem_cache_free(kcp->kcp_cache, kcp->kcp_kcd[i]);
|
||||
@@ -306,6 +306,7 @@ splat_kmem_test4(struct file *file, void *arg)
|
||||
}
|
||||
|
||||
max = kcp.kcp_count;
|
||||
ASSERT(max > 0);
|
||||
|
||||
/* Force shrinker to run */
|
||||
kmem_reap();
|
||||
|
||||
Reference in New Issue
Block a user