Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Apr 2001 15:24:46 -0700 (PDT)
From:      Alfred Perlstein <alfred@FreeBSD.org>
To:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/vm vm_zone.c
Message-ID:  <200104272224.f3RMOk092539@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
alfred      2001/04/27 15:24:46 PDT

  Modified files:
    sys/vm               vm_zone.c 
  Log:
  Address a number of problems with sysctl_vm_zone().
  
  The zone allocator's locks should be leaflocks, meaning that they
  should never be held when entering into another subsystem, however
  the sysctl grabs the zone global mutex and individual zone mutexes
  while holding the lock it calls SYSCTL_OUT which recurses into the
  VM subsystem in order to wire user memory to do a safe copy.  This
  can block and cause lock order reversals.
  
  To fix this:
    lock zone global.
    get a count of the number of zones.
    unlock global.
    allocate temporary storage.
    format and SYSCTL_OUT the banner.
    lock global.
    traverse list.
      make sure we haven't looped more than the initial count taken
        to avoid overflowing the allocated buffer.
      lock each nodes.
      read values and format into buffer.
      unlock individual node.
    unlock global.
    format and SYSCTL_OUT the rest of the data.
    free storage.
    return.
  
  Other problems included not checking for errors when doing sysctl out
  of the column header.  Fixed.
  
  Inconsistant termination of the copied string. Fixed.
  
  Objected to by: des (for not using sbuf)
  
  Since the output is not variable length and I'm actually over
  allocating signifigantly and I'd like to get this fixed now, I'll
  work on the sbuf convertion at a later date.  I would not object
  to someone else taking it upon themselves to convert it to sbuf.
  I hold no MAINTIANER rights to this code (for now).
  
  Revision  Changes    Path
  1.43      +30 -12    src/sys/vm/vm_zone.c


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




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