cvs commit: src/sys/kern kern_malloc.c src/sys/conf options

Robert Watson rwatson at
Wed Mar 26 20:18:43 PST 2003

rwatson     2003/03/26 12:18:40 PST

  FreeBSD src repository

  Modified files:
    sys/kern             kern_malloc.c 
    sys/conf             options 
  Add a new kernel option, MALLOC_MAKE_FAILURES, which compiles
  in a debugging feature causing M_NOWAIT allocations to fail at
  a specified rate.  This can be useful for detecting poor
  handling of M_NOWAIT: the most frequent problems I've bumped
  into are unconditional deference of the pointer even though
  it's NULL, and hangs as a result of a lost event where memory
  for the event couldn't be allocated.  Two sysctls are added:
    How often to generate a failure: if set to 0 (default), this
    feature is disabled.  Otherwise, the frequency of failures --
    I've been using 10 (one in ten mallocs fails), but other
    popular settings might be much lower or much higher.
    Number of times a coerced malloc failure has occurred as a
    result of this feature.  Useful for tracking what might have
    happened and whether failures are being generated.
  Useful possible additions: tying failure rate to malloc type,
  printfs indicating the thread that experienced the coerced
  Reviewed by:    jeffr, jhb
  Revision  Changes    Path
  1.384     +1 -0      src/sys/conf/options
  1.120     +26 -0     src/sys/kern/kern_malloc.c

More information about the cvs-src mailing list