From owner-freebsd-current@FreeBSD.ORG Tue Feb 3 10:56:15 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8537916A4CE; Tue, 3 Feb 2004 10:56:15 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F0F843D2F; Tue, 3 Feb 2004 10:56:14 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i13IuAT1008219; Tue, 3 Feb 2004 12:56:10 -0600 (CST) (envelope-from dan) Date: Tue, 3 Feb 2004 12:56:10 -0600 From: Dan Nelson To: Dag-Erling Smorgrav Message-ID: <20040203185610.GA77596@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.5.1i cc: Robert Watson cc: current@freebsd.org Subject: Re: Coalescing pipe allocation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2004 18:56:15 -0000 In the last episode (Feb 03), Dag-Erling Smorgrav said: > Robert Watson writes: > > Well, I don't know so much about the portability issues, but I can > > say that it seems silly to incur the costs if few applications take > > advantage of the feature. Especially if the cost can be defered > > until the feature is exercised. I have some local patches that > > defer all pipe buffer allocation until a particular direction is > > first used, but this has some potential downsides, including > > increasing the chances that a lack of resources is discovered on > > first-use, rather than on allocation of the pipe (which makes it a > > lot harder to write robust applications). > > This is IMHO a lesser evil than the current behaviour, and there is > always the option of blocking if memory can't be allocated right away. How about always allocating at least enough for one direction (since I don't think many people just call pipe() to use up fds), and deferring allocation of the other direction until it's used? I'm assuming it's easy to swap the buffers around if you allocate the 0->1 direction but for some reason the program decides to use the 1->0 one instead. That should cover the usual case. -- Dan Nelson dnelson@allantgroup.com