From owner-freebsd-current@FreeBSD.ORG Thu Mar 11 16:23:54 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 091D516A4CE for ; Thu, 11 Mar 2004 16:23:54 -0800 (PST) Received: from maestro.tackymt.homeip.net (YahooBB219181148055.bbtec.net [219.181.148.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A00443D31 for ; Thu, 11 Mar 2004 16:23:51 -0800 (PST) (envelope-from taku@cent.saitama-u.ac.jp) Received: from YahooBB219181148055.bbtec.net (localhost [IPv6:::1]) i2C0NmAx001733 for ; Fri, 12 Mar 2004 09:23:49 +0900 (JST) (envelope-from taku@cent.saitama-u.ac.jp) Date: Fri, 12 Mar 2004 09:23:47 +0900 From: Taku YAMAMOTO To: freebsd-current@freebsd.org Message-Id: <20040312092348.18be60e0.taku@cent.saitama-u.ac.jp> In-Reply-To: <4050BBCB.50302@cinci.rr.com> References: <4050BBCB.50302@cinci.rr.com> Organization: Advanced Computer and Communication Studies Society X-Mailer: Sylpheed version 0.9.8a-gtk2-20040109 (GTK+ 2.2.4; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [PATCH] for SCHED_ULE & libpthread issue (was Re: I like SCHED_4BSD) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2004 00:23:54 -0000 On Thu, 11 Mar 2004 14:19:39 -0500 Mike B wrote: > Conrad Sabatier wrote: (snip) > seconds to redraw the screen. This sluggishness isn't exclusive to > firefox, opera and openoffice are noticeably laggy under ULE as well. I > WANT to like and use ULE but the performance just isn't there. I think all of those applications are using libpthread, which utilizes scheduler activation mechanism. Unfortunately, due to over-optimization in sched_switch(), SCHED_ULE doesn't give reasonable CPU time to the threads which are using scheduler activation. Detailed analisis is described in my previous message posted to current@: "SCHED_ULE sometimes puts P_SA processes into ksq_next unnecessarily" <20040213063139.71298ea9.taku@cent.saitama-u.ac.jp> or http://docs.freebsd.org/cgi/mid.cgi?20040213063139.71298ea9.taku , which didn't get broader audience :( Until the problem is fully addressed, I will propose following patch to be applied. (the least intrusive one attached in the former message) --- sched_ule.c.orig Fri Feb 13 05:24:48 2004 +++ sched_ule.c Fri Feb 13 05:37:53 2004 @@ -186,7 +186,7 @@ #define SCHED_INTERACTIVE(kg) \ (sched_interact_score(kg) < SCHED_INTERACT_THRESH) #define SCHED_CURR(kg, ke) \ - (ke->ke_thread->td_priority != kg->kg_user_pri || \ + (ke->ke_thread->td_priority < kg->kg_user_pri || \ SCHED_INTERACTIVE(kg)) /* @@ -1166,11 +1166,8 @@ */ if ((ke->ke_flags & KEF_ASSIGNED) == 0) { if (TD_IS_RUNNING(td)) { - if (td->td_proc->p_flag & P_SA) { - kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke); - setrunqueue(td); - } else - kseq_runq_add(KSEQ_SELF(), ke); + kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke); + setrunqueue(td); } else { if (ke->ke_runq) { kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke); -- -|-__ YAMAMOTO, Taku | __ <