public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Con Kolivas <kernel@kolivas.org>
To: Jens Axboe <axboe@suse.de>
Cc: linux <linux-kernel@vger.kernel.org>
Subject: time slice cfq comments
Date: Sat, 11 Dec 2004 09:20:33 +1100	[thread overview]
Message-ID: <41BA2131.4040608@kolivas.org> (raw)

Hi Jens

Just thought I'd make a few comments about some of the code in your time 
sliced cfq.

+	if (p->array)
+		return min(cpu_curr(task_cpu(p))->time_slice,
+					(unsigned int)MAX_SLEEP_AVG);

MAX_SLEEP_AVG is basically 10 * the average time_slice so this will 
always return task_cpu(p)->time_slice as the min value (except for the 
race you described in your comments). What you probably want is

+		return min(cpu_curr(task_cpu(p))->time_slice,
+					(unsigned int)DEF_TIMESLICE);


Further down you do:
+	/*
+	 * for blocked tasks, return half of the average sleep time.
+	 * (because this is the average sleep-time we'll see if we
+	 * sample the period randomly.)
+	 */
+	return NS_TO_JIFFIES(p->sleep_avg) / 2;

unfortunately p->sleep_avg is a non-linear value (weighted upwards 
towards MAX_SLEEP_AVG). I suspect here you want

+	return NS_TO_JIFFIES(p->sleep_avg) / MAX_BONUS;

I don't see any need for / 2.

Cheers,
Con

             reply	other threads:[~2004-12-10 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-10 22:20 Con Kolivas [this message]
2004-12-11  8:50 ` time slice cfq comments Jens Axboe
2004-12-11  9:16 ` Ingo Molnar
2004-12-11 13:55   ` Con Kolivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41BA2131.4040608@kolivas.org \
    --to=kernel@kolivas.org \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox