linux-stable/include
NeilBrown de9e82c355 lib: add light-weight queuing mechanism.
lwq is a FIFO single-linked queue that only requires a spinlock
for dequeueing, which happens in process context.  Enqueueing is atomic
with no spinlock and can happen in any context.

This is particularly useful when work items are queued from BH or IRQ
context, and when they are handled one at a time by dedicated threads.

Avoiding any locking when enqueueing means there is no need to disable
BH or interrupts, which is generally best avoided (particularly when
there are any RT tasks on the machine).

This solution is superior to using "list_head" links because we need
half as many pointers in the data structures, and because list_head
lists would need locking to add items to the queue.

This solution is superior to a bespoke solution as all locking and
container_of casting is integrated, so the interface is simple.

Despite the similar name, this solution meets a distinctly different
need to kfifo.  kfifo provides a fixed sized circular buffer to which
data can be added at one end and removed at the other, and does not
provide any locking.  lwq does not have any size limit and works with
data structures (objects?) rather than data (bytes).

A unit test for basic functionality, which runs at boot time, is included.

Signed-off-by: NeilBrown <neilb@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: David Gow <davidgow@google.com>
Cc: linux-kernel@vger.kernel.org
Message-Id: <20230911111333.4d1a872330e924a00acb905b@linux-foundation.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2023-10-16 12:44:06 -04:00
..
acpi cpu-hotplug: Provide prototypes for arch CPU registration 2023-10-11 14:27:37 +02:00
asm-generic hyperv-fixes for v6.6-rc6 2023-10-10 11:01:21 -07:00
clocksource
crypto
drm drm/tests: helpers: Avoid a driver uaf 2023-09-14 13:57:58 +02:00
dt-bindings
keys
kunit
kvm
linux lib: add light-weight queuing mechanism. 2023-10-16 12:44:06 -04:00
math-emu
media
memory
misc
net net: macsec: indicate next pn update when offloading 2023-10-10 10:30:30 +02:00
pcmcia
ras
rdma
rv
scsi ATA fixes for 6.6-rc4 2023-09-29 13:38:34 -07:00
soc
sound ASoC: core: Do not call link_exit() on uninitialized rtd objects 2023-09-29 14:17:49 +02:00
target
trace SUNRPC: add list of idle threads 2023-10-16 12:44:04 -04:00
uapi Including fixes from CAN and BPF. 2023-10-12 13:07:00 -07:00
ufs
vdso
video
xen arm/xen: remove lazy mode related definitions 2023-09-19 07:04:49 +02:00