From owner-svn-src-all@FreeBSD.ORG  Thu Jul  3 04:26:53 2014
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C1261EBB;
 Thu,  3 Jul 2014 04:26:53 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 952A32819;
 Thu,  3 Jul 2014 04:26:53 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s634QrbO006216;
 Thu, 3 Jul 2014 04:26:53 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
 by svn.freebsd.org (8.14.8/8.14.8/Submit) id s634QrDI006215;
 Thu, 3 Jul 2014 04:26:53 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201407030426.s634QrDI006215@svn.freebsd.org>
From: Alexander Motin <mav@FreeBSD.org>
Date: Thu, 3 Jul 2014 04:26:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r268204 - head/sys/cam/ctl
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Jul 2014 04:26:53 -0000

Author: mav
Date: Thu Jul  3 04:26:53 2014
New Revision: 268204
URL: http://svnweb.freebsd.org/changeset/base/268204

Log:
  Use separate memory type M_CTLIO for I/Os.
  
  CTL allocate large amount of RAM.  This change give some more stats.
  
  MFC after:	2 weeks

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Thu Jul  3 00:31:13 2014	(r268203)
+++ head/sys/cam/ctl/ctl.c	Thu Jul  3 04:26:53 2014	(r268204)
@@ -455,6 +455,7 @@ static struct cdevsw ctl_cdevsw = {
 
 
 MALLOC_DEFINE(M_CTL, "ctlmem", "Memory used for CTL");
+MALLOC_DEFINE(M_CTLIO, "ctlio", "Memory used for CTL requests");
 
 static int ctl_module_event_handler(module_t, int /*modeventtype_t*/, void *);
 
@@ -3358,7 +3359,7 @@ ctl_pool_create(struct ctl_softc *ctl_so
 	 * tracking.
 	 */
 	for (i = 0; i < total_ctl_io; i++) {
-		cur_io = (union ctl_io *)malloc(sizeof(*cur_io), M_CTL,
+		cur_io = (union ctl_io *)malloc(sizeof(*cur_io), M_CTLIO,
 						M_NOWAIT);
 		if (cur_io == NULL) {
 			retval = ENOMEM;
@@ -3377,7 +3378,7 @@ ctl_pool_create(struct ctl_softc *ctl_so
 							      links);
 			STAILQ_REMOVE(&pool->free_queue, &cur_io->io_hdr,
 				      ctl_io_hdr, links);
-			free(cur_io, M_CTL);
+			free(cur_io, M_CTLIO);
 		}
 
 		free(pool, M_CTL);
@@ -3439,7 +3440,7 @@ ctl_pool_release(struct ctl_io_pool *poo
 	while ((io = (union ctl_io *)STAILQ_FIRST(&pool->free_queue)) != NULL) {
 		STAILQ_REMOVE(&pool->free_queue, &io->io_hdr, ctl_io_hdr,
 			      links);
-		free(io, M_CTL);
+		free(io, M_CTLIO);
 	}
 
 	STAILQ_REMOVE(&ctl_softc->io_pools, pool, ctl_io_pool, links);
@@ -3543,7 +3544,7 @@ ctl_alloc_io(void *pool_ref)
 	 * The emergency pool (if it exists) didn't have one, so try an
 	 * atomic (i.e. nonblocking) malloc and see if we get lucky.
 	 */
-	io = (union ctl_io *)malloc(sizeof(*io), M_CTL, M_NOWAIT);
+	io = (union ctl_io *)malloc(sizeof(*io), M_CTLIO, M_NOWAIT);
 	if (io != NULL) {
 		/*
 		 * If the emergency pool exists but is empty, add this
@@ -3595,7 +3596,7 @@ ctl_free_io(union ctl_io *io)
 		 * Otherwise, just free it.  We probably malloced it and
 		 * the emergency pool wasn't available.
 		 */
-		free(io, M_CTL);
+		free(io, M_CTLIO);
 	}
 
 }