From owner-freebsd-current Thu Jan 28 16:10:55 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA15309 for freebsd-current-outgoing; Thu, 28 Jan 1999 16:10:55 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA15301 for ; Thu, 28 Jan 1999 16:10:52 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.2/8.9.1) id QAA11960; Thu, 28 Jan 1999 16:10:26 -0800 (PST) (envelope-from dillon) Date: Thu, 28 Jan 1999 16:10:26 -0800 (PST) From: Matthew Dillon Message-Id: <199901290010.QAA11960@apollo.backplane.com> To: HighWind Software Information Cc: current@FreeBSD.ORG Subject: Re: Locked at 100% User CPU References: <199901282130.QAA13214@highwind.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :In libc_r, I don't think the code in uthread_kern.c's :_thread_kern_select() scales at all. : :As the number of network connections (TCP) to my application grows, I :believe this routine takes longer and longer and my CPU goes to 100% :user space. : :Something makes me believe that this routine has an n^2 (or worse) :problem. Seems to relate to the number of fd's to select() on. At :about 300-400, even a P2 400Mhz gets max'd out and gets nothing done. : :Anybody have a feeling as to what is wrong here? : :-Rob This code looks pretty bad, all right. It looks like it is O(N^2) in PS_SELECT_WAIT(), especially if descriptors get randomly strewn amoungst the threads. It also looks like it is regenerating the FDS masks on each call completely from scratch. It also looks like it is scanning the entire thread list - both waiting and running threads, to prioritize the next thread to run and then scanning it again to select the thread priority, then scanning the whole list yet again to find the one it wants to run. This is massively unscaleable code. Is anyone actively working on it? -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message