From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 27 Mar 2004 11:30:31 +0000 Subject: Re: [PATCH[ udevd race conditions and performance, assorted cleanups Message-Id: <20040327113031.GB2636@vrfy.org> List-Id: References: <4065078F.1070008@sympatico.ca> In-Reply-To: <4065078F.1070008@sympatico.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Fri, Mar 26, 2004 at 11:48:15PM -0500, Chris Friesen wrote: > > This patch covers a number of areas: > > 1) sysfs.h is fixed up to use the common dbg() macro. This fixes the > case where DEBUG is defined but USE_LOG isn't. > > 2) udevstart.c is modified to include the proper headers, rather than > getting them indirectly which can break depending on Makefile flags > > 3) udevd.c gets some major changes: > a) I added a pipe from the signal handler. This fixes the race > conditions that I mentioned earlier. Basically, the point of the pipe > is to force the select() call to return immediately if a signal handler > fired before we actually started the select() call. This then lets us > run the appropriate code based on flags set in the signal handler proper. > b) I added a number of flags to coalesce calls to common routines. This > should make things slightly more efficient. > c) since most calls will tend to come in with a sequence number larger > than what has been received, I switched msg_queue_insert() to scan the > msg_list backwards to improve performance. Looks really nice, seems a bit faster too. Whitespace is broken, no tabs? > while (1) { > - handle_msg(ssock); > - > - while(msg_q_timeout) { > - msg_q_timeout = 0; > - msg_queue_manager(); > + fd_set workreadfds = readfds; > + retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); > + > + if (retval < 0) { > + dbg("error in select: %s", strerror(errno)); > + continue; We interrupt select() intentionally, so better do not call it "error" in syslog :) thanks, Kay ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel