From owner-cvs-all@FreeBSD.ORG Sat Nov 24 13:14:06 2007 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8644B16A41A; Sat, 24 Nov 2007 13:14:06 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id 1EE8A13C448; Sat, 24 Nov 2007 13:14:05 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 43C1045F3F; Sat, 24 Nov 2007 14:14:04 +0100 (CET) Received: from localhost (154.81.datacomsa.pl [195.34.81.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 25FD745E97; Sat, 24 Nov 2007 14:13:57 +0100 (CET) Date: Sat, 24 Nov 2007 14:13:25 +0100 From: Pawel Jakub Dawidek To: Randall Stewart Message-ID: <20071124131325.GE12811@garage.freebsd.pl> References: <200711151420.lAFEK79n059303@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UBnjLfzoMQYIXCvq" Content-Disposition: inline In-Reply-To: <200711151420.lAFEK79n059303@repoman.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 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 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2007 13:14:06 -0000 --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--