From owner-freebsd-scsi Wed Feb 5 21:34:05 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id VAA11867 for freebsd-scsi-outgoing; Wed, 5 Feb 1997 21:34:05 -0800 (PST) Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id VAA11824; Wed, 5 Feb 1997 21:33:54 -0800 (PST) Received: from narnia (localhost [127.0.0.1]) by narnia.plutotech.com (8.8.5/8.7.3) with ESMTP id VAA00624; Wed, 5 Feb 1997 21:33:58 -0800 (PST) Message-Id: <199702060533.VAA00624@narnia.plutotech.com> To: Simon Shapiro cc: freebsd-scsi@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: Contigious (spelling?) allocation in kernel In-reply-to: Your message of "Wed, 05 Feb 1997 19:33:54 PST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 05 Feb 1997 21:33:57 -0800 From: "Justin T. Gibbs" Sender: owner-freebsd-scsi@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >I need to allocate a contigious (one piece :-) block of memory for a DMA >scatter/gather list. If it is more than a page, you must use contigmalloc. contigmalloc may only be used close to boot time if you want to ensure it will work. >The HBA knows how to do scatter gather, but wants a >single pointer to a single block of memory that holds the entire list. >The SG structure is very plain, 32bits for length and 32bits for physical >address; 8 bytes. The thing is capable of up to 8192 entries, which give >us a possible list of 64KB per request list. You really think you're going to ever transfer a full 32MB of data in a single transaction? Even if you were, you'd have to do something special to the kernel since it currently only generates requests of at most 64k (its a silly restriction and it should die a horrible death). Assuming you did have a way to stuff 32MB through all of the layers, you'd probably be better off chopping that I/O into smaller chunks so as to reduce the amount of SG space you must allocate. At anything over 8k, the transaction overhead starts to become an increasingly small percentage of your I/O time, so dropping even down as low as 1MB per transaction may better utilize your resources. >As each HBA can have up to 256 concurrent requests, with who knows how >many more in the driver's queue, the list can grow quite impressively. >Since most requests are smaller, it seems very wasteful to allocate all >this memory upfront. So malloc is in order, but what are the options? You don't want to continuously malloc your SG list. This will kill your performance. If it is acceptable for the system to run with all 256 requests active at once, you have to be able to deal with all of the requests being allocated anyway, so you might as well pool them. >Thanx, > >Simon -- Justin T. Gibbs =========================================== FreeBSD: Turning PCs into workstations ===========================================