Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Mar 2009 15:39:46 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/gnu/fs/xfs/FreeBSD xfs_buf.c src/sys/kern vfs_bio.c src/sys/sys buf.h proc.h src/sys/ufs/ffs ffs_vfsops.c
Message-ID:  <200903161540.n2GFeveU045097@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
kib         2009-03-16 15:39:46 UTC

  FreeBSD src repository

  Modified files:
    sys/gnu/fs/xfs/FreeBSD xfs_buf.c 
    sys/kern             vfs_bio.c 
    sys/sys              buf.h proc.h 
    sys/ufs/ffs          ffs_vfsops.c 
  Log:
  SVN rev 189878 on 2009-03-16 15:39:46Z by kib
  
  Fix two issues with bufdaemon, often causing the processes to hang in
  the "nbufkv" sleep.
  
  First, ffs background cg group block write requests a new buffer for
  the shadow copy. When ffs_bufwrite() is called from the bufdaemon due
  to buffers shortage, requesting the buffer deadlock bufdaemon.
  Introduce a new flag for getnewbuf(), GB_NOWAIT_BD, to request getblk
  to not block while allocating the buffer, and return failure
  instead. Add a flag argument to the geteblk to allow to pass the flags
  to getblk(). Do not repeat the getnewbuf() call from geteblk if buffer
  allocation failed and either GB_NOWAIT_BD is specified, or geteblk()
  is called from bufdaemon (or its helper, see below). In
  ffs_bufwrite(), fall back to synchronous cg block write if shadow
  block allocation failed.
  
  Since r107847, buffer write assumes that vnode owning the buffer is
  locked. The second problem is that buffer cache may accumulate many
  buffers belonging to limited number of vnodes. With such workload,
  quite often threads that own the mentioned vnodes locks are trying to
  read another block from the vnodes, and, due to buffer cache
  exhaustion, are asking bufdaemon for help. Bufdaemon is unable to make
  any substantial progress because the vnodes are locked.
  
  Allow the threads owning vnode locks to help the bufdaemon by doing
  the flush pass over the buffer cache before getnewbuf() is going to
  uninterruptible sleep. Move the flushing code from buf_daemon() to new
  helper function buf_do_flush(), that is called from getnewbuf().  The
  number of buffers flushed by single call to buf_do_flush() from
  getnewbuf() is limited by new sysctl vfs.flushbufqtarget.  Prevent
  recursive calls to buf_do_flush() by marking the bufdaemon and threads
  that temporarily help bufdaemon by TDP_BUFNEED flag.
  
  In collaboration with:  pho
  Reviewed by:     tegge (previous version)
  Tested by:       glebius, yandex ...
  MFC after:       3 weeks
  
  Revision  Changes    Path
  1.6       +2 -2      src/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c
  1.551     +117 -45   src/sys/kern/vfs_bio.c
  1.209     +2 -1      src/sys/sys/buf.h
  1.529     +1 -1      src/sys/sys/proc.h
  1.364     +4 -1      src/sys/ufs/ffs/ffs_vfsops.c



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