Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2006 14:38:24 GMT
From:      Alexander Leidinger <netchild@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 106208 for review
Message-ID:  <200609161438.k8GEcO4F057062@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609161438.k8GEcO4F057062>