From owner-freebsd-current Sat Nov 27 18:43:34 1999 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id F195414D8B for ; Sat, 27 Nov 1999 18:43:30 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id SAA40107; Sat, 27 Nov 1999 18:43:27 -0800 (PST) (envelope-from dillon) Date: Sat, 27 Nov 1999 18:43:27 -0800 (PST) From: Matthew Dillon Message-Id: <199911280243.SAA40107@apollo.backplane.com> To: John Polstra Cc: wollman@khavrinen.lcs.mit.edu, current@FreeBSD.ORG Subject: Re: Route table leaks References: <199911220150.UAA78559@khavrinen.lcs.mit.edu> <199911221552.KAA84691@khavrinen.lcs.mit.edu> <199911270141.RAA29416@vashon.polstra.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :+ s = splnet(); :+ RTFREE(rt); :+ splx(s); :... :+ s = splnet(); :+ RTFREE(rt); :+ splx(s); :+ } : ro->ro_rt = rtalloc1(&ro->ro_dst, 1, ignore); : } : : :Now for my questions: : :1. Do I really need the splnet calls around RTFREE? Yes. Because the route table may be flushed from an interrupt in a low memory situation. :2. To eliminate all the duplicated code, shall I make rtalloc just :call rtalloc_ign(ro, 0UL)? I assume that was avoided originally for :performance reasons, but now there's more code than before. : :John :-- : John Polstra jdp@polstra.com Hmm. One trick I used in the VM code was to put the common code in an inline static function and leave the external functions broken out to avoid an unnecessary call chain. So, for example, if rtalloc() and rtalloc_ign() require a bunch of extra code prior to calling rtalloc1(), then a good solution would be to put the bulk of that code or perhaps even all of it in an inline and then have rtalloc() and rtalloc_ign() both call the inline with appropriate arguments. Remember that inline function calls *WILL* optimize constants passed as arguments. It's a very effective way to genericize a block of code without creating any procedural recursion. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message