OpenBSD CVS

CVS log for src/sys/kern/kern_bufq.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.35 / (download) - annotate - [select for diffs], Mon Dec 5 23:18:37 2022 UTC (17 months, 3 weeks ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

zap a pile of dangling tabs

Revision 1.34 / (download) - annotate - [select for diffs], Sun Aug 14 01:58:27 2022 UTC (21 months, 2 weeks ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.33: +1 -2 lines
Diff to previous 1.33 (colored)

remove unneeded includes in sys/kern
ok mpi@ miod@

Revision 1.33 / (download) - annotate - [select for diffs], Thu Dec 19 17:40:10 2019 UTC (4 years, 5 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.32: +9 -8 lines
Diff to previous 1.32 (colored)

Convert infinite sleeps to {m,t}sleep_nsec(9).

ok visa@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Aug 16 17:52:17 2017 UTC (6 years, 9 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Correct the check when selecting an elevator

Coverity CID 1453358; Severity: unlikely, not user-visible

ok millert, visa

Revision 1.31 / (download) - annotate - [select for diffs], Fri Aug 28 00:03:53 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.30: +7 -3 lines
Diff to previous 1.30 (colored)

fairly simple sizes for free(); ok tedu

Revision 1.30 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:50 2015 UTC (9 years, 2 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.29: +1 -3 lines
Diff to previous 1.29 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Jan 9 05:04:22 2015 UTC (9 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

save the bufq pointer from the buf before we turn it loose so it won't
change on us. also, remove unused second arg to bufq_wait.
from pedro at bitrig via david hill.
ok beck kettenis

Revision 1.28 / (download) - annotate - [select for diffs], Sat Jul 12 18:43:32 2014 UTC (9 years, 10 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.27 / (download) - annotate - [select for diffs], Fri Jun 27 16:38:03 2014 UTC (9 years, 11 months ago) by miod
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

Do not KASSERT an unsigned value being >= 0 after decrementing it; instead,
KASSERT it being > 0 before decrementing.
ok dlg@

Revision 1.26 / (download) - annotate - [select for diffs], Wed Nov 20 23:52:42 2013 UTC (10 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.25: +2 -74 lines
Diff to previous 1.25 (colored)

now that all the direct users of disksort have been removed, we can now
safely remove disksort.

most hardware and pretty much all of the kernel has moved to logical
block addressing when dealing with disks, so the assumptions disksort
was built against arent useful these days. it also has bad edge cases
with lots of sequential writes being able to starve other io requests
in the system. these issues have been addressed by becks nscan
implementation, which disksort was previously deprecated in favour
of.

this removes the guts of disksort and the bufq wrapper around it.

ok miod@

Revision 1.25 / (download) - annotate - [select for diffs], Wed Apr 10 01:35:55 2013 UTC (11 years, 1 month ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

Fix various glitches in queue macro usage.

ok millert@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Mar 18 22:13:04 2013 UTC (11 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.23: +1 -2 lines
Diff to previous 1.23 (colored)

nscan only operates in a single direction, remove leftover dir variable.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Oct 17 23:58:25 2012 UTC (11 years, 7 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

use wakeup here, not wakeup_one - avoids problem of not waking up writers
when there are more of them than size of queue waiting, and nothing else
going on.

ok miod@ kettenis@

Revision 1.22 / (download) - annotate - [select for diffs], Tue Oct 9 16:44:15 2012 UTC (11 years, 7 months ago) by beck
Branch: MAIN
Changes since 1.21: +4 -4 lines
Diff to previous 1.21 (colored)

Capilization in comment, and document leftoverroom, + knf nit, spotted by theo

Revision 1.21 / (download) - annotate - [select for diffs], Tue Oct 9 15:36:50 2012 UTC (11 years, 7 months ago) by beck
Branch: MAIN
Changes since 1.20: +155 -1 lines
Diff to previous 1.20 (colored)

Add nscan as a disk queueing algorithm, and make it the default with
n = 128.

Nscan is essentially, the disksort() style elevator algorithm for ordering
disk io operations. The difference is that we will re-order in chunks of
128 operations before continuing with the rest of the work. This avoids
the problem that the basic SCAN (aka elevator algorithm) has where continued
inserts can cause starvation, where requests can sit for a long time. This
solves problems where usb sticks could be unusable while long sequential
writes happened, and systems would become unresponsive while dumping core.

hacked upon (and this version largely rewritten by) tedu and myself.

Note, can be "backed out" by changing BUFQ_DEFAULT back to disksort in
buf.h

ok kettenis@, tedu@, krw@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Oct 9 15:12:15 2012 UTC (11 years, 7 months ago) by beck
Branch: MAIN
Changes since 1.19: +36 -1 lines
Diff to previous 1.19 (colored)

bufq write limiting

This change ensures that writes in flight from the buffer cache via bufq
are limited to a high water mark - when the limit is reached the writes sleep
until the amount of IO in flight reaches a low water mark. This avoids the
problem where userland can queue an unlimited amount of asynchronous writes
resulting in the consumption of all/most of our available buffer mapping kva,
and a long queue of writes to the disk.

ok kettenis@, krw@

Revision 1.19 / (download) - annotate - [select for diffs], Fri Sep 3 10:51:53 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.18: +2 -1 lines
Diff to previous 1.18 (colored)

thib insists i take responsibility too

Revision 1.18 / (download) - annotate - [select for diffs], Thu Sep 2 07:05:39 2010 UTC (13 years, 9 months ago) by matthew
Branch: MAIN
Changes since 1.17: +24 -28 lines
Diff to previous 1.17 (colored)

Inline bufq_impl_disksort and bufq_impl_fifo's definitions into
bufq_impls.  Also, make bufq_impls const.

ok dlg@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Sep 1 19:30:59 2010 UTC (13 years, 9 months ago) by kettenis
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

There is no point doing wakeups in bufq_done() unless we're actually in the
process of quiescing I/O.

ok dlg@

Revision 1.16 / (download) - annotate - [select for diffs], Wed Sep 1 19:23:05 2010 UTC (13 years, 9 months ago) by kettenis
Branch: MAIN
Changes since 1.15: +6 -2 lines
Diff to previous 1.15 (colored)

Clarify why we can walk the list of bufqs without holding a mutex with a
comment.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Sep 1 01:38:12 2010 UTC (13 years, 9 months ago) by dlg
Branch: MAIN
Changes since 1.14: +200 -97 lines
Diff to previous 1.14 (colored)

make struct bufq a member of the softc for devices that use it,
rather than it being a pointer to something that needs to be allocated
at attach. since all these devices need a bufq to operate, it makes
sense to have it allocated as part of the softc and get bufq_init
to just initialise all its fields. it also gets rid of the possibility
that you wont be able to allocate the bufq struct during attach,
which is something you dont want to happen.

secondly, it consistently implements a split between wrapper functions
and the per discipline implementation of the bufq handlers. it
consistently does the locking in the wrappers rather than doing
half in the wrappers and the other half in the implementations.

it also consistently handles the outstanding bufq bq pointer in the
wrappers.

this hides most of the implementation inside kern_bufq.c. the only
stuff left in buf.h is for the bits each implementation needs to
put inside struct buf.

tested by thib@ krw@ and me
ok thib@ matthew@
no objection from krw@

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jul 19 21:39:15 2010 UTC (13 years, 10 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.13: +10 -10 lines
Diff to previous 1.13 (colored)

Avoid interleaving of mutexes that would leave is with the wrong spl after
calling bufq_quiesce().  Problem spotted by matthew@.

ok matthew@, thib@

Revision 1.13 / (download) - annotate - [select for diffs], Thu Jul 8 23:18:55 2010 UTC (13 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.12: +1 -8 lines
Diff to previous 1.12 (colored)

dont count requeued io as outstanding io. there is a 1:1 mapping
between calls to bufq_enqueue and bufq_done calls, but bufq_requeue
can be called multiple times on an io in between the enqueue and
done. if you keep incrementing outstanding you'll never stop sleeping
for suspend.

bufq_requeue can be called via interrupts, so we cannot sleep
there.

the problems fixed by this diff were never hit cos the adapters
people are testing/running with do not cause bufq_requeue to be
called.

thanks to thib@ for helping me understand the code better
ok thib@ deraadt@ kettenis@ tedu@

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jul 7 10:50:50 2010 UTC (13 years, 10 months ago) by dlg
Branch: MAIN
Changes since 1.11: +4 -4 lines
Diff to previous 1.11 (colored)

minor whitespace tweaks and clean up extra ;

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jun 30 02:29:18 2010 UTC (13 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.10: +3 -4 lines
Diff to previous 1.10 (colored)

Call msleep(9) with PNORELOCK rather than calling mtx_leave()
immediately afterwards.

ok thib@, tedu@

Revision 1.10 / (download) - annotate - [select for diffs], Wed Jun 30 02:26:58 2010 UTC (13 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.9: +6 -6 lines
Diff to previous 1.9 (colored)

Switch bufq FIFO disclipline from using TAILQs to SIMPLEQs.

ok thib@

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jun 29 18:52:20 2010 UTC (13 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.8: +101 -12 lines
Diff to previous 1.8 (colored)

Introduce bufq_quiesce(), which will block I/O ifrom getting on the queues,
and waits until all I/O currently on the queues has been completed.  To get
I/O going again, call bufq_restart().

To be used for suspend/resume.

Joint effort with thib@, tedu@; tested by mlarkin@, marco@

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jun 27 22:05:28 2010 UTC (13 years, 11 months ago) by thib
Branch: MAIN
Changes since 1.7: +1 -40 lines
Diff to previous 1.7 (colored)

garbage collect the debugging goo

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jun 27 04:29:31 2010 UTC (13 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.6: +1 -0 lines
Diff to previous 1.6 (colored)

Add missing $OpenBSD$.

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jun 21 07:01:51 2010 UTC (13 years, 11 months ago) by thib
Branch: MAIN
Changes since 1.5: +0 -1 lines
Diff to previous 1.5 (colored)

No need to include mutex.h twice.
Pointed out by Jung <moorang at gmail dot com>

Revision 1.5 / (download) - annotate - [select for diffs], Sun May 30 21:23:44 2010 UTC (14 years ago) by krw
Branch: MAIN
Changes since 1.4: +6 -5 lines
Diff to previous 1.4 (colored)

Tweak bufq code to handle corner cases. Makes upcoming cd(4)
conversion to bufq work. Taken from n2k10 scsi buf queueing code.

ok thib@

Revision 1.4 / (download) - annotate - [select for diffs], Wed May 26 16:38:20 2010 UTC (14 years ago) by thib
Branch: MAIN
Changes since 1.3: +145 -55 lines
Diff to previous 1.3 (colored)

Trying this again. Mixing anoncvs with cvs is _not_ a good idea.

Reintroduce bufqs. A few changes since it was backed out after some good
comments from dlg@.

No need for a separate bufq.h, keep all of in buf.h; As requested by kittens
and deraadt.

Only sd(4) and wd(4) for now. The rest of the drivers will be converted soon,
also other goodies like heuristics for sd(4) for selecting the bufq type and
the death of disksort() are forthcoming.

Tested on: i386, amd64, sparc64, macppc, loongson and alpha by myself and
phessler.

OK art@, beck@, kettenis@, oga@

Revision 1.3, Wed Jun 17 01:30:30 2009 UTC (14 years, 11 months ago) by thib
Branch: MAIN
Changes since 1.2: +1 -1 lines
FILE REMOVED

Revert bufq's. this is inline with the major midlayer reverts that
have been going on. this appears to bring us back to stable state.

lots of testing by oga and ariane and my self.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jun 4 19:16:13 2009 UTC (15 years ago) by thib
Branch: MAIN
Changes since 1.1: +2 -0 lines
Diff to previous 1.1 (colored)

add $OpenBSD$ tag

Revision 1.1 / (download) - annotate - [select for diffs], Wed Jun 3 22:09:30 2009 UTC (15 years ago) by thib
Branch: MAIN

add a flexible buffer queue (bufq) api, based on the never used
one by tedu@. It doesn't do anything smart yet, it just uses
plain old disksort. we also keep the old method of queueing bufs
since some miods have crazy MD drivers that need some love.

ok beck@, art@
tested by many on many archs.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.