From owner-freebsd-net Sat Sep 9 0:33:17 2000 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 347DF37B422 for ; Sat, 9 Sep 2000 00:33:14 -0700 (PDT) Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id E65D46E2BB9 for ; Sat, 9 Sep 2000 00:26:08 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e897IYF00261; Sat, 9 Sep 2000 00:18:34 -0700 (PDT) Date: Sat, 9 Sep 2000 00:18:34 -0700 From: Alfred Perlstein To: Julian Elischer Cc: net@freebsd.org Subject: Re: threading tcp/ip is fun. Message-ID: <20000909001833.M12231@fw.wintelcom.net> References: <20000908154320.J12231@fw.wintelcom.net> <39B9CC11.41C67EA6@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: <39B9CC11.41C67EA6@elischer.org>; from julian@elischer.org on Fri, Sep 08, 2000 at 10:35:13PM -0700 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Julian Elischer [000908 22:35] wrote: > Alfred Perlstein wrote: > > > > http://www.wintelcom.net/~bright/thrsock.diff > > > > Should refresh every two minutes as I progress through the tcp/ip > > code in an attempt to thread it. > > > > If you have suggestions or works in progress please let me know. > > > There is a lot of use of "atomic_ad_long()" > nearly always with an increment of '1'. > Would there be any advantage of having an > "atomic_increment_long()"? > (a_incl()) > > with the introduction of heavier weight operations at low level > (e.g."atomic_add_long(a , 1);" vs "a += 1;" > the optimal way if unrolling loops and threading decision > trees may change.. > > e.g. > > if (XXX) > a_incl(a); > if (YYY) > a_incl(b); > if (ZZZ) > a_incl(c); > > might be slower than: > small_lock() > if (XXX)a+=1; > if (YYY)b+=1; > if (ZZZ)c+=1; > drop_small_lock(); > > (in this case not likely, but it's something to keep in mind I guess.) Actually it's very good idea, however, right now I'm just trying to get it SMP safe, at a later date we may want to keep CPU private counters and in one operation update the tcpstat struct on exit from the routine. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message