Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 May 2011 19:32:02 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/netinet in_pcb.c in_pcb.h
Message-ID:  <201105231932.p4NJWNeH056619@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
rwatson     2011-05-23 19:32:02 UTC

  FreeBSD src repository

  Modified files:
    sys/netinet          in_pcb.c in_pcb.h 
  Log:
  SVN rev 222217 on 2011-05-23 19:32:02Z by rwatson
  
  Continue to refine inpcb reference counting and locking, in preparation for
  reworking of inpcbinfo locking:
  
  (1) Convert inpcb reference counting from manually manipulated integers to
      the refcount(9) KPI.  This allows the refcount to be managed atomically
      with an inpcb read lock rather than write lock, or even with no inpcb
      lock at all.  As a result, in_pcbref() also no longer requires an inpcb
      lock, so can be performed solely using the lock used to look up an
      inpcb.
  
  (2) Shift more inpcb freeing activity from the in_pcbrele() context (via
      in_pcbfree_internal) to the explicit in_pcbfree() context.  This means
      that the inpcb refcount is increasingly used only to maintain memory
      stability, not actually defer the clean up of inpcb protocol parts.
      This is desirable as many of those protocol parts required the pcbinfo
      lock, which we'd like not to acquire in in_pcbrele() contexts.  Document
      this in comments better.
  
  (3) Introduce new read-locked and write-locked in_pcbrele() variations,
      in_pcbrele_rlocked() and in_pcbrele_wlocked(), which allow the inpcb to
      be properly unlocked as needed.  in_pcbrele() is a wrapper around the
      latter, and should probably go away at some point.  This makes it
      easier to use this weak reference model when holding only a read lock,
      as will happen in the future.
  
  This may well be safe to MFC, but some more KBI analysis is required.
  
  Reviewed by:    bz
  MFC after:      3 weeks
  Sponsored by:   Juniper Networks, Inc.
  
  Revision  Changes    Path
  1.276     +91 -63    src/sys/netinet/in_pcb.c
  1.148     +2 -0      src/sys/netinet/in_pcb.h



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