Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet syn_cache_put(): defer all pool_put() to the cal...



details:   https://anonhg.NetBSD.org/src/rev/f1052f2b65ce
branches:  trunk
changeset: 754149:f1052f2b65ce
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Apr 21 20:40:16 2010 +0000

description:
syn_cache_put(): defer all pool_put() to the callout. Reschedule
the callout if needed so frees are not delayed too much.
syn_cache_timer(): we can't call syn_cache_put() here any more,
so move code deleted from syn_cache_put() here.

Avoid KASSERT() in kern_timeout.c because pool_put() is called from
ipintr context, as reported in
http://mail-index.netbsd.org/tech-kern/2010/03/19/msg007762.html
Thanks to Andrew Doran and Mindaugas Rasiukevicius for help and review.

diffstat:

 sys/netinet/tcp_input.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (47 lines):

diff -r cf880bd88ee6 -r f1052f2b65ce sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Wed Apr 21 20:07:02 2010 +0000
+++ b/sys/netinet/tcp_input.c   Wed Apr 21 20:40:16 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.303 2010/04/16 03:13:03 rmind Exp $    */
+/*     $NetBSD: tcp_input.c,v 1.304 2010/04/21 20:40:16 bouyer Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -145,7 +145,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.303 2010/04/16 03:13:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.304 2010/04/21 20:40:16 bouyer Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -3364,12 +3364,9 @@
        if (sc->sc_ipopts)
                (void) m_free(sc->sc_ipopts);
        rtcache_free(&sc->sc_route);
-       if (callout_invoking(&sc->sc_timer))
-               sc->sc_flags |= SCF_DEAD;
-       else {
-               callout_destroy(&sc->sc_timer);
-               pool_put(&syn_cache_pool, sc);
-       }
+       sc->sc_flags |= SCF_DEAD;
+       if (!callout_invoking(&sc->sc_timer))
+               callout_schedule(&(sc)->sc_timer, 1);
 }
 
 void
@@ -3533,7 +3530,11 @@
  dropit:
        TCP_STATINC(TCP_STAT_SC_TIMED_OUT);
        syn_cache_rm(sc);
-       syn_cache_put(sc);      /* calls pool_put but see spl above */
+       if (sc->sc_ipopts)
+               (void) m_free(sc->sc_ipopts);
+       rtcache_free(&sc->sc_route);
+       callout_destroy(&sc->sc_timer);
+       pool_put(&syn_cache_pool, sc);
        KERNEL_UNLOCK_ONE(NULL);
        mutex_exit(softnet_lock);
 }



Home | Main Index | Thread Index | Old Index