Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Nov 1999 18:43:27 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        John Polstra <jdp@polstra.com>
Cc:        wollman@khavrinen.lcs.mit.edu, current@FreeBSD.ORG
Subject:   Re: Route table leaks
Message-ID:  <199911280243.SAA40107@apollo.backplane.com>
References:  <199911220150.UAA78559@khavrinen.lcs.mit.edu> <XFMail.991121195840.jdp@polstra.com> <199911221552.KAA84691@khavrinen.lcs.mit.edu> <199911270141.RAA29416@vashon.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help

:+		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 
					<dillon@backplane.com>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911280243.SAA40107>