Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 6 Mar 2003 12:03:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 6 Mar 2003 12:03:20 -0500 Received: from mx2.elte.hu ([157.181.151.9]:17071 "HELO mx2.elte.hu") by vger.kernel.org with SMTP id ; Thu, 6 Mar 2003 12:03:06 -0500 Date: Thu, 6 Mar 2003 18:13:20 +0100 (CET) From: Ingo Molnar Reply-To: Ingo Molnar To: Linus Torvalds Cc: Andrew Morton , Robert Love , Subject: Re: [patch] "HT scheduler", sched-2.5.63-B3 In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1663 Lines: 41 On Wed, 5 Mar 2003, Linus Torvalds wrote: > p->sleep_avg += sleep_time; > - if (p->sleep_avg > MAX_SLEEP_AVG) > + if (p->sleep_avg > MAX_SLEEP_AVG) { > + int ticks = p->sleep_avg - MAX_SLEEP_AVG + current->sleep_avg; > p->sleep_avg = MAX_SLEEP_AVG; > + if (ticks > MAX_SLEEP_AVG) > + ticks = MAX_SLEEP_AVG; > + if (!in_interrupt()) > + current->sleep_avg = ticks; > + } > + > p->prio = effective_prio(p); interesting approach, but it has one problem which so far i tried to avoid: it makes it too easy for a process to gain a bonus. Until now pretty much the only way to get an interactive bonus was to actually sleep. Another rule was that interactivity is kept constant, ie. the only 'source' of interactivity was passing time, not some artificial activity performed by any process. Even the timeslice passing across fork()/exit() is controlled carefully to maintain the total sum of timeslices. With the above code it's enough to keep a single helper thread around which blocks on a pipe, to create an almost endless source of interactivity bonus. And does not even have to be 'deliberate' - there's tons of code that just waits for a CPU-bound task to finish (eg. 'make' waiting for gcc to finish), and which processes/threads have a maximum boost already, in which case the interactivity boost is not justified. Anyway, Andrew, could you give Linus' patch a go as well? Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/