From owner-freebsd-net Sun Jul 7 1:37:14 2002 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 2D31F37B400 for ; Sun, 7 Jul 2002 01:37:10 -0700 (PDT) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73ECE43E09 for ; Sun, 7 Jul 2002 01:37:10 -0700 (PDT) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 49BECAE39D; Sun, 7 Jul 2002 01:37:10 -0700 (PDT) Date: Sun, 7 Jul 2002 01:37:10 -0700 From: Alfred Perlstein To: net@freebsd.org Subject: the incredible shrinking socket Message-ID: <20020707083710.GM97638@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.27i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Some time ago I noticed that there appeared to be several members of struct socket that were either only used by listen sockets or only used by data sockets. I've taken a stab at unionizing the members and we wind up saving 28 bytes per socket on i386, and probably nearly double that on any 64 bit platform. That's ~15%, which isn't too shabby. The problem is that besideds making things a tad ugly, I haven't gotten it completely working yet. I seem to have some sort of bug with rendevous listening sockets, telnetd can accept a connection, however then the cpu goes to 100%, sshd drops my connection right after authorizing me. Most of the problem is because now that it's unionized, it's hard to make sure someone isn't clobbering the data as some functions expect _all_ fields to be there. Anyhow, if anyone wanted to take a look, the patch is here: http://people.freebsd.org/~alfred/deltas/sockunion.diff.gz -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message