1. 23 Jan, 2022 1 commit
    • Alexander Motin's avatar
      Fix inverse sleep logic in buf_daemon(). · c8c305ac
      Alexander Motin authored
      Before commit 3cec5c77 buf_daemon() went to longer 1s sleep if
      numdirtybuffers <= lodirtybuffers.  After that commit new condition
      !BIT_EMPTY(BUF_DOMAINS, &bdlodirty) got opposite -- true when one
      or more more domains is above lodirtybuffers.  As result, on freshly
      booted system with no dirty buffers buf_daemon() wakes up 10 times
      per second and probably only 1 time per second when there is actual
      work to do.
      
      MFC after:	1 week
      Reviewed by:	kib, markj
      Tested by:	pho
      Differential revision:	https://reviews.freebsd.org/D33890
      
      (cherry picked from commit e76c0108)
      c8c305ac
  2. 06 Dec, 2021 1 commit
  3. 07 Oct, 2021 1 commit
  4. 04 Mar, 2021 1 commit
    • Mark Johnston's avatar
      buf: Fix the dirtybufthresh check · 0bec69d1
      Mark Johnston authored
      dirtybufthresh is a watermark, slightly below the high watermark for
      dirty buffers.  When a delayed write is issued, the dirtying thread will
      start flushing buffers if the dirtybufthresh watermark is reached.  This
      helps ensure that the high watermark is not reached, otherwise
      performance will degrade as clustering and other optimizations are
      disabled (see buf_dirty_count_severe()).
      
      When the buffer cache was partitioned into "domains", the dirtybufthresh
      threshold checks were not updated.  Fix this.
      
      Reported by:	Shrikanth R Kamath <kshrikanth@juniper.net>
      Reviewed by:	rlibby, mckusick, kib, bdrewery
      Sponsored by:	Juniper Networks, Inc., Klara, Inc.
      Fixes:		3cec5c77
      Differential Revision:	https://reviews.freebsd.org/D28901
      
      (cherry picked from commit 369706a6)
      0bec69d1
  5. 29 Oct, 2020 2 commits
    • brooks's avatar
      MFC r366911: · 29b6f27b
      brooks authored
      vmapbuf: don't smuggle address or length in buf
      
      Instead, add arguments to vmapbuf.  Since this argument is
      always a pointer use a type of void * and cast to vm_offset_t in
      vmapbuf.  (In CheriBSD we've altered vm_fault_quick_hold_pages to
      take a pointer and check its bounds.)
      
      In no other situtation does b_data contain a user pointer and vmapbuf
      replaces b_data with the actual mapping.
      
      Suggested by:	jhb
      Reviewed by:	imp, jhb
      Obtained from:	CheriBSD
      Sponsored by:	DARPA
      Differential Revision:	https://reviews.freebsd.org/D26784
      29b6f27b
    • Brooks Davis's avatar
      MFC r366911: · 11e20040
      Brooks Davis authored
      vmapbuf: don't smuggle address or length in buf
      
      Instead, add arguments to vmapbuf.  Since this argument is
      always a pointer use a type of void * and cast to vm_offset_t in
      vmapbuf.  (In CheriBSD we've altered vm_fault_quick_hold_pages to
      take a pointer and check its bounds.)
      
      In no other situtation does b_data contain a user pointer and vmapbuf
      replaces b_data with the actual mapping.
      
      Suggested by:	jhb
      Reviewed by:	imp, jhb
      Obtained from:	CheriBSD
      Sponsored by:	DARPA
      Differential Revision:	https://reviews.freebsd.org/D26784
      11e20040
  6. 06 Apr, 2020 2 commits
  7. 12 Mar, 2020 2 commits
    • kib's avatar
      MFC r358676: · 7159cacc
      kib authored
      buffer pager: deref ucred immediately after read.
      7159cacc
    • Konstantin Belousov's avatar
      MFC r358676: · 5d9813f8
      Konstantin Belousov authored
      buffer pager: deref ucred immediately after read.
      5d9813f8
  8. 11 Dec, 2019 2 commits
  9. 08 Sep, 2019 2 commits
    • markj's avatar
      MFC r350431: · 232f154c
      markj authored
      Centralize the logic in vfs_vmio_unwire() and sendfile_free_page().
      232f154c
    • Mark Johnston's avatar
      MFC r350431: · 8cb553dc
      Mark Johnston authored
      Centralize the logic in vfs_vmio_unwire() and sendfile_free_page().
      8cb553dc
  10. 31 May, 2019 2 commits
    • asomers's avatar
      MFC r346750: · 451da44f
      asomers authored
      [skip ci] fix typo in comment from r59840
      
      Sponsored by:	The FreeBSD Foundation
      451da44f
    • Alan Somers's avatar
      MFC r346750: · 9bf950c3
      Alan Somers authored
      [skip ci] fix typo in comment from r59840
      
      Sponsored by:	The FreeBSD Foundation
      9bf950c3
  11. 08 May, 2019 2 commits
    • markj's avatar
      MFC r346888: · f1301a20
      markj authored
      Stop checking TD_IDLETHREAD() in buffer cache routines.
      f1301a20
    • Mark Johnston's avatar
      MFC r346888: · 268de8a2
      Mark Johnston authored
      Stop checking TD_IDLETHREAD() in buffer cache routines.
      268de8a2
  12. 29 Mar, 2019 2 commits
  13. 09 Dec, 2018 2 commits
    • kib's avatar
      MFC r341397: · f9161827
      kib authored
      Correct accuracy of the barrier writes accounting.
      f9161827
    • Konstantin Belousov's avatar
      MFC r341397: · c7830684
      Konstantin Belousov authored
      Correct accuracy of the barrier writes accounting.
      c7830684
  14. 20 Nov, 2018 2 commits
    • markj's avatar
      MFC r340192: · 5eb1b86d
      markj authored
      Use plain atomic_{add,subtract} when that's sufficient.
      5eb1b86d
    • Mark Johnston's avatar
      MFC r340192: · 1d984adb
      Mark Johnston authored
      Use plain atomic_{add,subtract} when that's sufficient.
      1d984adb
  15. 01 Jun, 2018 2 commits
    • markj's avatar
      Avoid completing I/O when dumping core after a panic. · 746978a0
      markj authored
      Filesystem or pager completion callbacks are generally non-functional
      after a panic and may trigger deadlocks if invoked in this context
      (e.g., by attempting to destroying a buffer mapping).  To avoid this
      situation, short-circuit I/O completion in biodone().
      
      Reviewed by:	imp
      Discussed with:	mav
      MFC after:	2 weeks
      Differential Revision:	https://reviews.freebsd.org/D15592
      746978a0
    • Mark Johnston's avatar
      Avoid completing I/O when dumping core after a panic. · 3fb14f61
      Mark Johnston authored
      Filesystem or pager completion callbacks are generally non-functional
      after a panic and may trigger deadlocks if invoked in this context
      (e.g., by attempting to destroying a buffer mapping).  To avoid this
      situation, short-circuit I/O completion in biodone().
      
      Reviewed by:	imp
      Discussed with:	mav
      MFC after:	2 weeks
      Differential Revision:	https://reviews.freebsd.org/D15592
      3fb14f61
  16. 19 May, 2018 2 commits
  17. 13 May, 2018 2 commits
    • kib's avatar
      Detect and optimize reads from the hole on UFS. · 57921f91
      kib authored
      - Create getblkx(9) variant of getblk(9) which can return error.
      - Add GB_NOSPARSE flag for getblk()/getblkx() which requests that BMAP
        was performed before the buffer is created, and EJUSTRETURN returned
        in case the requested block does not exist.
      - Make ffs_read() use GB_NOSPARSE to avoid instantiating buffer (and
        allocating the pages for it), copying from zero_region instead.
      
      The end result is less page allocations and buffer recycling when a
      hole is read, which is important for some benchmarks.
      
      Requested and reviewed by:	jeff
      Tested by:	pho
      Sponsored by:	The FreeBSD Foundation
      MFC after:	2 weeks
      Differential revision:	https://reviews.freebsd.org/D14917
      57921f91
    • Konstantin Belousov's avatar
      Detect and optimize reads from the hole on UFS. · 2ebc8829
      Konstantin Belousov authored
      - Create getblkx(9) variant of getblk(9) which can return error.
      - Add GB_NOSPARSE flag for getblk()/getblkx() which requests that BMAP
        was performed before the buffer is created, and EJUSTRETURN returned
        in case the requested block does not exist.
      - Make ffs_read() use GB_NOSPARSE to avoid instantiating buffer (and
        allocating the pages for it), copying from zero_region instead.
      
      The end result is less page allocations and buffer recycling when a
      hole is read, which is important for some benchmarks.
      
      Requested and reviewed by:	jeff
      Tested by:	pho
      Sponsored by:	The FreeBSD Foundation
      MFC after:	2 weeks
      Differential revision:	https://reviews.freebsd.org/D14917
      2ebc8829
  18. 04 May, 2018 2 commits
    • markj's avatar
      Fix some races introduced in r332974. · c1d51518
      markj authored
      With r332974, when performing a synchronized access of a page's "queue"
      field, one must first check whether the page is logically dequeued. If
      so, then the page lock does not prevent the page from being removed
      from its page queue. Intoduce vm_page_queue(), which returns the page's
      logical queue index. In some cases, direct access to the "queue" field
      is still required, but such accesses should be confined to sys/vm.
      
      Reported and tested by:	pho
      Reviewed by:	kib
      Sponsored by:	Dell EMC Isilon
      Differential Revision:	https://reviews.freebsd.org/D15280
      c1d51518
    • Mark Johnston's avatar
      Fix some races introduced in r332974. · 1b5c869d
      Mark Johnston authored
      With r332974, when performing a synchronized access of a page's "queue"
      field, one must first check whether the page is logically dequeued. If
      so, then the page lock does not prevent the page from being removed
      from its page queue. Intoduce vm_page_queue(), which returns the page's
      logical queue index. In some cases, direct access to the "queue" field
      is still required, but such accesses should be confined to sys/vm.
      
      Reported and tested by:	pho
      Reviewed by:	kib
      Sponsored by:	Dell EMC Isilon
      Differential Revision:	https://reviews.freebsd.org/D15280
      1b5c869d
  19. 22 Apr, 2018 2 commits
    • tijl's avatar
      Make bufdaemon and bufspacedaemon use kthread_suspend_check instead of · 83ceca9a
      tijl authored
      kproc_suspend_check.  In r329612 bufspacedaemon was turned into a thread
      of the bufdaemon process causing both to call kproc_suspend_check with the
      same proc argument and that function contains the following while loop:
      
      while (SIGISMEMBER(p->p_siglist, SIGSTOP)) {
      	wakeup(&p->p_siglist);
      	msleep(&p->p_siglist, &p->p_mtx, PPAUSE, "kpsusp", 0);
      }
      
      So one thread wakes up the other and the other wakes up the first again,
      locking up UP machines on shutdown.
      
      Also register the shutdown handlers with SHUTDOWN_PRI_LAST + 100 so they
      run after the syncer has shutdown, because the syncer can cause a
      situation where bufdaemon help is needed to proceed.
      
      PR:		227404
      Reviewed by:	kib
      Tested by:	cy, rmacklem
      83ceca9a
    • Tijl Coosemans's avatar
      Make bufdaemon and bufspacedaemon use kthread_suspend_check instead of · 7dfbbc61
      Tijl Coosemans authored
      kproc_suspend_check.  In r329612 bufspacedaemon was turned into a thread
      of the bufdaemon process causing both to call kproc_suspend_check with the
      same proc argument and that function contains the following while loop:
      
      while (SIGISMEMBER(p->p_siglist, SIGSTOP)) {
      	wakeup(&p->p_siglist);
      	msleep(&p->p_siglist, &p->p_mtx, PPAUSE, "kpsusp", 0);
      }
      
      So one thread wakes up the other and the other wakes up the first again,
      locking up UP machines on shutdown.
      
      Also register the shutdown handlers with SHUTDOWN_PRI_LAST + 100 so they
      run after the syncer has shutdown, because the syncer can cause a
      situation where bufdaemon help is needed to proceed.
      
      PR:		227404
      Reviewed by:	kib
      Tested by:	cy, rmacklem
      7dfbbc61
  20. 06 Apr, 2018 2 commits
    • brooks's avatar
      Move most of the contents of opt_compat.h to opt_global.h. · 9d79658a
      brooks authored
      opt_compat.h is mentioned in nearly 180 files. In-progress network
      driver compabibility improvements may add over 100 more so this is
      closer to "just about everywhere" than "only some files" per the
      guidance in sys/conf/options.
      
      Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
      sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
      is created on all architectures.
      
      Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
      set of compiled files.
      
      Reviewed by:	kib, cem, jhb, jtl
      Sponsored by:	DARPA, AFRL
      Differential Revision:	https://reviews.freebsd.org/D14941
      9d79658a
    • Brooks Davis's avatar
      Move most of the contents of opt_compat.h to opt_global.h. · 6469bdcd
      Brooks Davis authored
      opt_compat.h is mentioned in nearly 180 files. In-progress network
      driver compabibility improvements may add over 100 more so this is
      closer to "just about everywhere" than "only some files" per the
      guidance in sys/conf/options.
      
      Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
      sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
      is created on all architectures.
      
      Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
      set of compiled files.
      
      Reviewed by:	kib, cem, jhb, jtl
      Sponsored by:	DARPA, AFRL
      Differential Revision:	https://reviews.freebsd.org/D14941
      6469bdcd
  21. 26 Mar, 2018 2 commits
  22. 22 Mar, 2018 2 commits