Re: led(9) blinking using dedicated thread

From: John Baldwin <>
Date: Mon, 02 Aug 2021 14:30:25 UTC
On 7/19/21 1:36 AM, Andriy Gapon wrote:
> I would like to change led(9) so that it invokes LED control methods from a
> thread rather rather than from a callout.  This is to support LEDs behind USB
> and I2C where (common) implementations use sleeping waits.
> I have created a review request for the proposed change:
> In the current version the thread is created at init time and is kept around
> forever.  That could be changed to create the thread when a first blinking LED
> is configured.  Also, the thread could be destroyed when a last "blinker" is
> removed.

I would vote for creating the thread on first need.  I would like to cleanup
some of our existing kthreads (soaiod* which is my fault and for which the
fix is simple, and KTLS for which the fix is slightly less simple) so that we
only create kthreads that are needed.  kthreads don't necessarily eat up a
lot of resources (wired memory for kstacks and the various data structures),
but I think only creating the ones we need is ideal, especially for things
enabled by default in GENERIC.

John Baldwin