From owner-freebsd-hackers@freebsd.org Thu Jan 7 17:09:43 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32A52A66DA6 for ; Thu, 7 Jan 2016 17:09:43 +0000 (UTC) (envelope-from mmatalka@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D79301BDA for ; Thu, 7 Jan 2016 17:09:42 +0000 (UTC) (envelope-from mmatalka@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id b14so133891668wmb.1 for ; Thu, 07 Jan 2016 09:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=inAJYkDmh18CCELnPKB1gbearTnTnTV7B6qMNm88bFs=; b=g1u1HTXfZjYrL48YRX541GCu5vr2L3Wa6HCmUNGihjC/MAqfu4t7Cnfe8WoClxDEPv 5LHhI0iiHrdp+IAJxKFsXIDrQ8hRSQWcdYDbuY04sPkTHQpJCMBDQDj5NGAb7NB3IQY1 Pq+hkeiHfMq4ewxgjE0OqN1vW3AgflmGHLmNWRWN3JZ4PQ+JnJbdo4xKL2wAafkt7C5Z 9AeDzGZs5/wqXwdPc5wf2K3cAxsIVjXcGZI363XrG0bhnp4GRUM/LcDEF66g1+HnJXXB kZnsNaD7e8sV93z+ca8QtQ32sUhoHhXh301M8A0HddY+g2Xe6h5UkTHOMNToY2rkfj1F +gSw== X-Received: by 10.194.22.167 with SMTP id e7mr5195908wjf.29.1452186581311; Thu, 07 Jan 2016 09:09:41 -0800 (PST) Received: from localhost (li195-236.members.linode.com. [178.79.139.236]) by smtp.gmail.com with ESMTPSA id kb5sm101552886wjc.20.2016.01.07.09.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jan 2016 09:09:39 -0800 (PST) From: Malcolm Matalka To: Jilles Tjoelker Cc: freebsd-hackers@freebsd.org Subject: Re: Can PIPE_BUF be increased? References: <86ziwho1jg.fsf@gmail.com> <20160107163041.GA35588@stack.nl> Date: Thu, 07 Jan 2016 17:09:37 +0000 In-Reply-To: <20160107163041.GA35588@stack.nl> (Jilles Tjoelker's message of "Thu, 7 Jan 2016 17:30:41 +0100") Message-ID: <86vb75nwoe.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 17:09:43 -0000 Jilles Tjoelker writes: > On Thu, Jan 07, 2016 at 04:27:56PM +0100, Malcolm Matalka wrote: >> Den 7 jan 2016 4:24 em skrev "Malcolm Matalka" : > >> > As far as I can tell, PIPE_BUF is 512 bytes by default. Using >> > getconf and looking at the header files /usr/include. I'm writing a >> > program that would benefit from a larger PIPE_BUF, is it possible to >> > change this value? It looks like Linux and OS X have a higher >> > default and OS X will do some magic to increase the size if >> > necessary. I haven't found anything indicating the same in FreeBSD. > >> I realized I might not be clear enough here: I'm trying to increase >> the number if bytes i can write to a pipe atomically. > > An active pipe buffer is always at least 4096 bytes, so this value can > be increased somewhat without increasing memory usage. Going all the way > to 4096 is probably unwise since it may require -- in low memory > situations -- the buffer to be emptied completely before > select/poll/kqueue report the pipe as writable again. > > You will need to recompile the kernel and filesystem and ABI > compatibility modules after making the change in sys/sys/syslimits.h. > > FreeBSD automatically resizes pipe buffers and copies large (>= 8192 > bytes) blocking writes directly from sender to receiver, but this does > not provide atomicity guarantees. If I understand you correctly, I cannot do anything, with strong guarantees, without recompiling the kernel? Thank you for the answer! /Malcolm