Author: mjg Date: Mon Nov 3 04:16:04 2014 New Revision: 274005 URL: https://svnweb.freebsd.org/changeset/base/274005
Log: filedesc: create a dedicated zone for struct filedesc0 Currently sizeof(struct filedesc0) is 1096 bytes, which means allocations from malloc use 2048 bytes. There is no easy way to shrink the structure <= 1024 an it is likely to grow in the future. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Nov 3 03:45:41 2014 (r274004) +++ head/sys/kern/kern_descrip.c Mon Nov 3 04:16:04 2014 (r274005) @@ -98,6 +98,7 @@ MALLOC_DEFINE(M_FILECAPS, "filecaps", "d MALLOC_DECLARE(M_FADVISE); static uma_zone_t file_zone; +static uma_zone_t filedesc0_zone; static int closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, int holdleaders); @@ -1801,7 +1802,7 @@ fdinit(struct filedesc *fdp) struct filedesc0 *newfdp0; struct filedesc *newfdp; - newfdp0 = malloc(sizeof *newfdp0, M_FILEDESC, M_WAITOK | M_ZERO); + newfdp0 = uma_zalloc(filedesc0_zone, M_WAITOK | M_ZERO); newfdp = &newfdp0->fd_fd; /* Create the file descriptor table. */ @@ -1865,7 +1866,7 @@ fddrop(struct filedesc *fdp) return; FILEDESC_LOCK_DESTROY(fdp); - free(fdp, M_FILEDESC); + uma_zfree(filedesc0_zone, fdp); } /* @@ -3538,6 +3539,8 @@ filelistinit(void *dummy) file_zone = uma_zcreate("Files", sizeof(struct file), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + filedesc0_zone = uma_zcreate("filedesc0", sizeof(struct filedesc0), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); mtx_init(&fdesc_mtx, "fdesc", NULL, MTX_DEF); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"