Date: Sat, 09 Sep 2000 23:13:21 -0400 From: "Louis A. Mamakos" <louie@TransSys.COM> To: Alfred Perlstein <bright@wintelcom.net> Cc: Julian Elischer <julian@elischer.org>, net@FreeBSD.ORG Subject: Re: threading tcp/ip is fun. Message-ID: <200009100313.e8A3DLG62901@whizzo.transsys.com> In-Reply-To: Your message of "Sat, 09 Sep 2000 00:18:34 PDT." <20000909001833.M12231@fw.wintelcom.net> References: <20000908154320.J12231@fw.wintelcom.net> <39B9CC11.41C67EA6@elischer.org> <20000909001833.M12231@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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. Many moons ago, Van Jacobson did some optimizations to the TCP protocol implementation such that the code path for the "normal" TCP segement (e.g., connection already open, segment that arrives is at the left window edge, etc.) was very, very short. It would seem that locking the TCP per-connection state as a whole is probably sufficient given the short duration that the lock is likely to be held for. I don't think it makes sense to lock the individual operations since the goal is to keep the whole data structure consistant, and not just worrying about any single element. I don't see how you can convince yourself that the Right Thing happens unless you arbitrate access to the connection state as a whole. louie To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009100313.e8A3DLG62901>