From 9b45155d2523e4490de40a1f1307e2d9da16f351 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 27 Jul 2008 23:01:25 +0000 Subject: [PATCH] HAMMER - fix kmalloc exhaustion w/ 3G ram * Give the hammer_inode structure its own kmalloc pool. --- sys/vfs/hammer/hammer.h | 3 ++- sys/vfs/hammer/hammer_inode.c | 8 ++++---- sys/vfs/hammer/hammer_vfsops.c | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/vfs/hammer/hammer.h b/sys/vfs/hammer/hammer.h index 22d0fed8fe..49d44ec68a 100644 --- a/sys/vfs/hammer/hammer.h +++ b/sys/vfs/hammer/hammer.h @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/vfs/hammer/hammer.h,v 1.122 2008/07/27 21:34:04 mneumann Exp $ + * $DragonFly: src/sys/vfs/hammer/hammer.h,v 1.123 2008/07/27 23:01:25 dillon Exp $ */ /* * This header file contains structures used internally by the HAMMERFS @@ -66,6 +66,7 @@ #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) MALLOC_DECLARE(M_HAMMER); +MALLOC_DECLARE(M_HAMMER_INO); /* * Kernel trace diff --git a/sys/vfs/hammer/hammer_inode.c b/sys/vfs/hammer/hammer_inode.c index 6d40e7f998..91bb2bc142 100644 --- a/sys/vfs/hammer/hammer_inode.c +++ b/sys/vfs/hammer/hammer_inode.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/vfs/hammer/hammer_inode.c,v 1.105 2008/07/18 00:19:53 dillon Exp $ + * $DragonFly: src/sys/vfs/hammer/hammer_inode.c,v 1.106 2008/07/27 23:01:25 dillon Exp $ */ #include "hammer.h" @@ -378,7 +378,7 @@ loop: /* * Allocate a new inode structure and deal with races later. */ - ip = kmalloc(sizeof(*ip), M_HAMMER, M_WAITOK|M_ZERO); + ip = kmalloc(sizeof(*ip), M_HAMMER_INO, M_WAITOK|M_ZERO); ++hammer_count_inodes; ++hmp->count_inodes; ip->obj_id = obj_id; @@ -511,7 +511,7 @@ hammer_create_inode(hammer_transaction_t trans, struct vattr *vap, hmp = trans->hmp; - ip = kmalloc(sizeof(*ip), M_HAMMER, M_WAITOK|M_ZERO); + ip = kmalloc(sizeof(*ip), M_HAMMER_INO, M_WAITOK|M_ZERO); ++hammer_count_inodes; ++hmp->count_inodes; @@ -672,7 +672,7 @@ hammer_free_inode(hammer_inode_t ip) hammer_rel_pseudofs(ip->hmp, ip->pfsm); ip->pfsm = NULL; } - kfree(ip, M_HAMMER); + kfree(ip, M_HAMMER_INO); ip = NULL; } diff --git a/sys/vfs/hammer/hammer_vfsops.c b/sys/vfs/hammer/hammer_vfsops.c index d8aedfe5fc..995149872f 100644 --- a/sys/vfs/hammer/hammer_vfsops.c +++ b/sys/vfs/hammer/hammer_vfsops.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/vfs/hammer/hammer_vfsops.c,v 1.68 2008/07/27 21:34:04 mneumann Exp $ + * $DragonFly: src/sys/vfs/hammer/hammer_vfsops.c,v 1.69 2008/07/27 23:01:25 dillon Exp $ */ #include @@ -248,7 +248,8 @@ static struct vfsops hammer_vfsops = { .vfs_checkexp = hammer_vfs_checkexp }; -MALLOC_DEFINE(M_HAMMER, "hammer-mount", "hammer mount"); +MALLOC_DEFINE(M_HAMMER, "hammer-general", "hammer general"); +MALLOC_DEFINE(M_HAMMER_INO, "hammer-inodes", "hammer inodes"); VFS_SET(hammer_vfsops, hammer, 0); MODULE_VERSION(hammer, 1); -- 2.11.4.GIT