Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 2021 07:30:25 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Andriy Gapon <avg@FreeBSD.org>, arch@FreeBSD.org
Subject:   Re: led(9) blinking using dedicated thread
Message-ID:  <10897070-834c-c1eb-b152-94295f197946@FreeBSD.org>
In-Reply-To: <ae299d95-9967-b1e5-0da0-15326650c847@FreeBSD.org>
References:  <ae299d95-9967-b1e5-0da0-15326650c847@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
> https://reviews.freebsd.org/D31215
> 
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?10897070-834c-c1eb-b152-94295f197946>