From owner-svn-src-all@FreeBSD.ORG Fri Feb 17 14:10:49 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB57C106566C; Fri, 17 Feb 2012 14:10:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by mx1.freebsd.org (Postfix) with ESMTP id 4A4B28FC1B; Fri, 17 Feb 2012 14:10:48 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q1HEAj1b009626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 18 Feb 2012 01:10:46 +1100 Date: Sat, 18 Feb 2012 01:10:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon In-Reply-To: <4F3E2150.8030504@FreeBSD.org> Message-ID: <20120218004042.L2893@besplex.bde.org> References: <201202160511.q1G5BZNk099785@svn.freebsd.org> <20120216181210.K1423@besplex.bde.org> <4F3CC40D.4000307@freebsd.org> <4F3CC5C4.7020501@FreeBSD.org> <4F3CC8A5.3030107@FreeBSD.org> <20120216174758.GA64180@nargothrond.kdm.org> <20120217053341.R1256@besplex.bde.org> <20120217000846.GA7641@nargothrond.kdm.org> <4F3D9D03.6020507@FreeBSD.org> <9CB7ECE8-FF10-43BE-9EBD-16953BE3B193@xcllnt.net> <4F3E2150.8030504@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Mailman-Approved-At: Fri, 17 Feb 2012 14:35:01 +0000 Cc: marcel@FreeBSD.org, Eitan Adler , svn-src-all@FreeBSD.org, "Kenneth D. Merry" , Marcel Moolenaar , src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Julian Elischer Subject: Re: svn commit: r231814 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2012 14:10:49 -0000 On Fri, 17 Feb 2012, Andriy Gapon wrote: > Since this issue has generated a sudden interest, I would like to use this > opportunity to point my older proposal as well: > http://lists.freebsd.org/pipermail/freebsd-arch/2011-August/011405.html Sorry I didn't check this now, and I don't remember it from last year :-). > Essentially the algorithm is: > 1. atomically (CAS) reserve a space in the message data buffer > 2. output full message to the reserved space (no contention here) This was essentially what it did in 2003, but with a reservation of only 1 byte since that seemed to be enough at the time. There is still non-atomicity for outputting to the reserved space, and contention in the unlikely event that there are enough callers to wrap the message buffer (the old code mentions a problem if there are the number of concurrent callers is >= the size of the message buffer, but I think the problem is a bit larger than that -- it only takes 2 concurrent callers, with one going very slowly while the other repeats calls that fills the message buffer. One going slowly can probably be easily arranged by single stepping it in a debugger). But these problems are rare. BTW, -current seems to have broken the checksum update for negative characters by removing one of the u_char casts. The char from the msgbuf is still cast to u_char, but the char in the int arg is now cast directly to u_int. All versions cast both terms u_int, but these casts are unimportant since the checksum is a u_int so the casts have no effect on systems with 32-bit 2's complement ints. > 3. atomically (CAS) append a pointer to the message in the message pointers buffer I wouldn't like this :-). Hmm, you could have a secondary buffer with hints to detect and recover from reordering in the main buffer. Bruce