From owner-p4-projects@FreeBSD.ORG Sat Sep 16 14:38:25 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5528A16A415; Sat, 16 Sep 2006 14:38:25 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3119516A407 for ; Sat, 16 Sep 2006 14:38:25 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E22C743D5F for ; Sat, 16 Sep 2006 14:38:24 +0000 (GMT) (envelope-from netchild@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k8GEcOVM057065 for ; Sat, 16 Sep 2006 14:38:24 GMT (envelope-from netchild@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8GEcO4F057062 for perforce@freebsd.org; Sat, 16 Sep 2006 14:38:24 GMT (envelope-from netchild@freebsd.org) Date: Sat, 16 Sep 2006 14:38:24 GMT Message-Id: <200609161438.k8GEcO4F057062@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to netchild@freebsd.org using -f From: Alexander Leidinger To: Perforce Change Reviews Cc: Subject: PERFORCE change 106208 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Sep 2006 14:38:25 -0000 http://perforce.freebsd.org/chv.cgi?CH=106208 Change 106208 by netchild@netchild_magellan on 2006/09/16 14:37:28 - Some minor modifications in comments and debugging messages. - Calling uma_zcreate() without the flag UMA_ZONE_NOFREE to fix a memory leak. Submitted by: mag@intron.ac Affected files ... .. //depot/projects/linuxolator/src/sys/compat/linux/linux_aio.c#2 edit Differences ... ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_aio.c#2 (text+ko) ==== @@ -61,7 +61,7 @@ /* Print message in syscall function */ #define DPRINTF(fmt, ...) printf(LMSG("%s(): " fmt), \ __func__, __VA_ARGS__) -/* Print message in non-syscall function */ +/* Print message in non-syscall function, the one more "P" means "private" */ #define DPPRINTF(fmt, ...) printf("linux(): %s(): " fmt "\n", \ __func__, __VA_ARGS__) @@ -87,9 +87,9 @@ * +------------+ +------------+ * | request | | request | * | | | | + * |.req_pbsd | |.req_pbsd | * |.req_porig | |.req_porig | * |.req_linux | |.req_linux | - * |.req_pbsd | |.req_pbsd | * | | | | * +------------+ +------------+ * | | @@ -178,7 +178,8 @@ * AIO_(UN)LOCK in /sys/kern/vfs_aio.c. Thus, the mutex much be unlocked * before calling functions of FreeBSD native AIO module. * - * XXX The member "kaio_mtx" is the first element of "struct kaioinfo". + * XXX + * I ASSUME the member "kaio_mtx" is the first element of "struct kaioinfo". */ #define LINUX_AIO_LOCK(p) { \ if ((p)->p_aioinfo == NULL) \ @@ -199,7 +200,7 @@ /* * XXX * Calling external function/variable declared with "static" is DANGEROUS !!! - * Compiler may use register to transfer function arguments for optimization, + * Compiler may use register to transfer calling arguments for optimization, * which is NOT a normal calling way and can cause kernel crash. */ @@ -236,6 +237,7 @@ return nerr; } +/* Allocate memory in user space */ static int user_malloc(struct thread *td, void **pp, size_t s) { struct mmap_args mmaparg; @@ -264,6 +266,7 @@ return nerr; } +/* Free memory in user space */ static int user_free(struct thread *td, void *p, size_t s) { struct munmap_args munmaparg; @@ -331,7 +334,7 @@ #else /* ! LINUX_AIO_DEBUG */ #define DUMP_FREEBSD_AIOCB(p, isu) -#define DUMP_TIMESPEC(f,t,a) +#define DUMP_TIMESPEC(f, t, a) #endif /* LINUX_AIO_DEBUG */ @@ -348,7 +351,7 @@ * I/O buffer */ pbsd->aio_nbytes = plnx->aio_nbytes; /* Number of bytes for I/O */ - switch (plnx->aio_lio_opcode) { /* LIO opcode */ + switch (plnx->aio_lio_opcode) { /* LIO opcode */ case LINUX_IOCB_CMD_PREAD: pbsd->aio_lio_opcode = LIO_READ; break; @@ -814,7 +817,7 @@ if (args->timeout != NULL) { nanouptime(&t1); /* Time before aio_suspend() */ DUMP_TIMESPEC("T1: ", &t1, - " (uptime before aio_suspend())"); + " (uptime before calling aio_suspend())"); } /* Prepare arguments for aio_suspend() */ @@ -831,7 +834,7 @@ if (args->timeout != NULL) { copyout(&timeout, u_ptimeout, sizeof(timeout)); aiosusargs.timeout = u_ptimeout; - DUMP_TIMESPEC("Time remaining: ", &timeout, ""); + DUMP_TIMESPEC("Time remained: ", &timeout, ""); } else { aiosusargs.timeout = NULL; } @@ -844,25 +847,25 @@ if (args->timeout != NULL) { nanouptime(&t2); /* Time after aio_suspend() */ DUMP_TIMESPEC("T2: ", &t2, - " (uptime after aio_suspend())"); + " (uptime after calling aio_suspend())"); timespecsub(&t2, &t1); /* * Time spent by * aio_suspend() */ DUMP_TIMESPEC("T_delta: ", &t2, - " (time spent by aio_suspend())"); + " (time spent by calling aio_suspend())"); if (timespeccmp(&t2, &timeout, >=)) { timespecclear(&timeout); /* Timed out */ } else { timespecsub(&timeout, &t2); /* Time remaining */ } - DUMP_TIMESPEC("Time remaining: ", &timeout, ""); + DUMP_TIMESPEC("Time remained: ", &timeout, ""); } if (aio_err == EAGAIN) { /* Timed out */ DPRINTF("returning(context %p): " - "timed out after aio_suspend()", + "timed out after calling aio_suspend()", pctx); break; } @@ -883,7 +886,7 @@ skip_substantial_0: td->td_retval[0] = i; /* user_free() resets td->td_retval[0] to 0 */ - DPRINTF("%d requests got out of context %p", i, pctx); + DPRINTF("%d requests are unhooked from the context %p", i, pctx); } /* End of dealing with request queue */ LINUX_AIO_CTX_UNLOCK(pctx); @@ -1170,11 +1173,11 @@ linux_aio_context_zone = uma_zcreate("LINUXAIOCTX", sizeof(struct linux_aio_context), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + UMA_ALIGN_PTR, 0); linux_aio_request_zone = uma_zcreate("LINUXAIOREQ", sizeof(struct linux_aio_request), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + UMA_ALIGN_PTR, 0); mtx_init(&linux_aio_context_list_mtx, "linux_aio_context_list", NULL, MTX_DEF); SLIST_INIT(&linux_aio_context_list);