Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Nov 2007 14:13:25 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Randall Stewart <rrs@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_thread.c src/sys/sys eventhandler.h
Message-ID:  <20071124131325.GE12811@garage.freebsd.pl>
In-Reply-To: <200711151420.lAFEK79n059303@repoman.freebsd.org>
References:  <200711151420.lAFEK79n059303@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--UBnjLfzoMQYIXCvq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 15, 2007 at 02:20:07PM +0000, Randall Stewart wrote:
> rrs         2007-11-15 14:20:07 UTC
>=20
>   FreeBSD src repository
>=20
>   Modified files:
>     sys/kern             kern_thread.c=20
>     sys/sys              eventhandler.h=20
>   Log:
>   - Adds event handlers for process_ctor,process_dtor, process_init,
>     process_fini, thread_ctor, thread_dtor, thread_init, thread_fini. This
>     will allow us to extend dynamically areas in proc/thread for dtrace ;=
-)

Thanks for doing this, I need such functionality for ZFS. To be precise,
I need to be called when thread is exiting. What I found tricky is that
thread may exit in two ways:

- thread_dtor() when one of many process' threads exists,
- proc_dtor() when the last process' thread exists.

If one wants to attach some data to a thread using this method and then
free the data on thread exit, both those events have to be used. In my
opionion this is confusing (was very confusing for me), that there is no
one place where I can handle thread exit when I don't care about
processes (even if a process is single-threaded we operate on a thread
in the kernel).

In other words, I'd like to propose a bit different solution. IMHO we
should rename events and be them called from the following functions:

event name		called from
----------		-----------
thread_init		thread_init
thread_fini		thread_fini
thread_start		thread_ctor, proc_ctor(?)
thread_exit		thread_dtor, proc_dtor
process_init		proc_init
process_fini		proc_fini
process_start		proc_ctor
process_exit		proc_exit

The only change except for renaming is calling thread_{start,exit} for
the last thread in a process as well.

What do you think?

>   Revision  Changes    Path
>   1.262     +5 -1      src/sys/kern/kern_thread.c
>   1.38      +18 -1     src/sys/sys/eventhandler.h

You forgot to commit changes to kern_proc.c it seems.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--UBnjLfzoMQYIXCvq
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFHSCN1ForvXbEpPzQRAoUdAJ0YMVAIDpBN5of7V5egNAKEsVqwlgCgojZo
kTxv1WXkXxR2FE0MkYC+DFU=
=bGEk
-----END PGP SIGNATURE-----

--UBnjLfzoMQYIXCvq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071124131325.GE12811>