public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Marc-Christian Petersen <m.c.p@wolk-project.de>,
	Jens Axboe <axboe@suse.de>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Georg Nikodym <georgn@somanetworks.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Matthias Mueller <matthias.mueller@rz.uni-karlsruhe.de>
Subject: Re: -rc7   Re: Linux 2.4.21-rc6
Date: Wed, 04 Jun 2003 21:57:47 +1000	[thread overview]
Message-ID: <3EDDDEBB.4080209@cyberone.com.au> (raw)
In-Reply-To: <20030604104825.GR3412@x30.school.suse.de>

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

Andrea Arcangeli wrote:

>On Wed, Jun 04, 2003 at 12:46:33PM +0200, Marc-Christian Petersen wrote:
>
>>On Wednesday 04 June 2003 12:42, Jens Axboe wrote:
>>
>>Hi Jens,
>>
>>
>>>>>the issue with batching in 2.4, is that it is blocking at 0 and waking
>>>>>at batch_requests. But it's not blocking new get_request to eat
>>>>>requests in the way back from 0 to batch_requests. I mean, there are
>>>>>two directions, when we move from batch_requests to 0 get_requests
>>>>>should return requests. in the way back from 0 to batch_requests the
>>>>>get_request should block (and it doesn't in 2.4, that is the problem)
>>>>>
>>>>do you see a chance to fix this up in 2.4?
>>>>
>>>Nick posted a patch to do so the other day and asked people to test.
>>>
>>Silly mcp. His mail was CC'ed to me :( ... F*ck huge inbox.
>>
>
>I was probably not CC'ed, I'll search for the email (and I was
>travelling the last few days so I didn't read every single l-k email yet
>sorry ;)
>
>
The patch I sent is actually against 2.4.20, contrary to my
babling. Reports I have had say it helps, but maybe not so
much as Andrew'ss fixes. Then Matthias Mueller ported my patch
to 2.4.21-rc6 which include Andrew's fixes.

It seems that they might be fixing two different problems.
It looks promising though.

My patch would not affect read IO throughput for a smallish
number of readers because the queue should never fill up.
 > 1 writer or a lot of readers could see some throughput
drop due to the patch causing the queue to be more FIFO
at high loads.

I have attached the patch again. Its against 2.4.20.

Nick

Matthias Mueller wrote:

>Currently I'm running 2.4.21-rc6 with your patch and the patch from Andrew 
>and it looks very promising.  Both patches seem to address two different 
>problems, combined I can have 2 parallel dds running and play music with 
>xmms and notice no sounddrops (actually i had one, but that was during 
>very high cpu load). Your patch seems to lower IO-throughput, but I 
>haven't tested this, so no real numbers, just my personal feelings and 
>the numbers 'time dd ...' gave me.
>  
>


[-- Attachment #2: blk-fair-batches-24 --]
[-- Type: text/plain, Size: 2612 bytes --]

--- linux-2.4/include/linux/blkdev.h.orig	2003-06-02 21:59:06.000000000 +1000
+++ linux-2.4/include/linux/blkdev.h	2003-06-02 22:39:57.000000000 +1000
@@ -118,13 +118,21 @@ struct request_queue
 	/*
 	 * Boolean that indicates whether this queue is plugged or not.
 	 */
-	char			plugged;
+	int			plugged:1;
 
 	/*
 	 * Boolean that indicates whether current_request is active or
 	 * not.
 	 */
-	char			head_active;
+	int			head_active:1;
+
+	/*
+	 * Booleans that indicate whether the queue's free requests have
+	 * been exhausted and is waiting to drop below the batch_requests
+	 * threshold
+	 */
+	int			read_full:1;
+	int			write_full:1;
 
 	unsigned long		bounce_pfn;
 
@@ -140,6 +148,30 @@ struct request_queue
 	wait_queue_head_t	wait_for_requests[2];
 };
 
+static inline void set_queue_full(request_queue_t *q, int rw)
+{
+	if (rw == READ)
+		q->read_full = 1;
+	else
+		q->write_full = 1;
+}
+
+static inline void clear_queue_full(request_queue_t *q, int rw)
+{
+	if (rw == READ)
+		q->read_full = 0;
+	else
+		q->write_full = 0;
+}
+
+static inline int queue_full(request_queue_t *q, int rw)
+{
+	if (rw == READ)
+		return q->read_full;
+	else
+		return q->write_full;
+}
+
 extern unsigned long blk_max_low_pfn, blk_max_pfn;
 
 #define BLK_BOUNCE_HIGH		(blk_max_low_pfn << PAGE_SHIFT)
--- linux-2.4/drivers/block/ll_rw_blk.c.orig	2003-06-02 21:56:54.000000000 +1000
+++ linux-2.4/drivers/block/ll_rw_blk.c	2003-06-02 22:17:13.000000000 +1000
@@ -513,7 +513,10 @@ static struct request *get_request(reque
 	struct request *rq = NULL;
 	struct request_list *rl = q->rq + rw;
 
-	if (!list_empty(&rl->free)) {
+	if (list_empty(&rl->free))
+		set_queue_full(q, rw);
+	
+	if (!queue_full(q, rw)) {
 		rq = blkdev_free_rq(&rl->free);
 		list_del(&rq->queue);
 		rl->count--;
@@ -594,7 +597,7 @@ static struct request *__get_request_wai
 	add_wait_queue_exclusive(&q->wait_for_requests[rw], &wait);
 	do {
 		set_current_state(TASK_UNINTERRUPTIBLE);
-		if (q->rq[rw].count == 0)
+		if (queue_full(q, rw))
 			schedule();
 		spin_lock_irq(&io_request_lock);
 		rq = get_request(q, rw);
@@ -829,9 +832,14 @@ void blkdev_release_request(struct reque
 	 */
 	if (q) {
 		list_add(&req->queue, &q->rq[rw].free);
-		if (++q->rq[rw].count >= q->batch_requests &&
-				waitqueue_active(&q->wait_for_requests[rw]))
-			wake_up(&q->wait_for_requests[rw]);
+		q->rq[rw].count++;
+		if (q->rq[rw].count >= q->batch_requests) {
+			if (q->rq[rw].count == q->batch_requests) 
+				clear_queue_full(q, rw);
+
+			if (waitqueue_active(&q->wait_for_requests[rw]))
+				wake_up(&q->wait_for_requests[rw]);
+		}
 	}
 }
 

  reply	other threads:[~2003-06-04 11:45 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-29  0:55 Linux 2.4.21-rc6 Marcelo Tosatti
2003-05-29  1:22 ` Con Kolivas
2003-05-29  5:24   ` Marc Wilson
2003-05-29  5:34     ` Riley Williams
2003-05-29  5:57       ` Marc Wilson
2003-05-29  7:15         ` Riley Williams
2003-05-29  8:38         ` Willy Tarreau
2003-05-29  8:40           ` Willy Tarreau
2003-06-03 16:02         ` Marcelo Tosatti
2003-06-03 16:13           ` Marc-Christian Petersen
2003-06-04 21:54             ` Pavel Machek
2003-06-05  2:10               ` Michael Frank
2003-06-03 16:30           ` Michael Frank
2003-06-03 16:53             ` Matthias Mueller
2003-06-03 16:59             ` Marc-Christian Petersen
2003-06-03 17:03               ` Marc-Christian Petersen
2003-06-03 18:02                 ` Anders Karlsson
2003-06-03 21:12                   ` J.A. Magallon
2003-06-03 21:18                     ` Marc-Christian Petersen
2003-06-03 17:23               ` Michael Frank
2003-06-04 14:56             ` Jakob Oestergaard
2003-06-04  4:04           ` Marc Wilson
2003-05-29 10:02 ` Con Kolivas
2003-05-29 18:00 ` Georg Nikodym
2003-05-29 19:11   ` -rc7 " Marcelo Tosatti
2003-05-29 19:56     ` Krzysiek Taraszka
2003-05-29 20:18       ` Krzysiek Taraszka
2003-06-04 18:17         ` Marcelo Tosatti
2003-06-04 21:41           ` Krzysiek Taraszka
2003-06-04 22:37             ` Alan Cox
2003-06-04 10:22     ` Andrea Arcangeli
2003-06-04 10:35       ` Marc-Christian Petersen
2003-06-04 10:42         ` Jens Axboe
2003-06-04 10:46           ` Marc-Christian Petersen
2003-06-04 10:48             ` Andrea Arcangeli
2003-06-04 11:57               ` Nick Piggin [this message]
2003-06-04 12:00                 ` Jens Axboe
2003-06-04 12:09                   ` Andrea Arcangeli
2003-06-04 12:20                     ` Jens Axboe
2003-06-04 20:50                       ` Rob Landley
2003-06-04 12:11                   ` Nick Piggin
2003-06-04 12:35                 ` Miquel van Smoorenburg
2003-06-09 21:39                 ` [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6) Chris Mason
2003-06-09 22:19                   ` Andrea Arcangeli
2003-06-10  0:27                     ` Chris Mason
2003-06-10 23:13                     ` Chris Mason
2003-06-11  0:16                       ` Andrea Arcangeli
2003-06-11  0:44                         ` Chris Mason
2003-06-09 23:51                   ` [PATCH] io stalls Nick Piggin
2003-06-10  0:32                     ` Chris Mason
2003-06-10  0:47                       ` Nick Piggin
2003-06-10  1:48                     ` Robert White
2003-06-10  2:13                       ` Chris Mason
2003-06-10 23:04                         ` Robert White
2003-06-11  0:58                           ` Chris Mason
2003-06-10  3:22                       ` Nick Piggin
2003-06-10 21:17                         ` Robert White
2003-06-11  0:40                           ` Nick Piggin
2003-06-11  0:33                   ` [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6) Andrea Arcangeli
2003-06-11  0:48                     ` [PATCH] io stalls Nick Piggin
2003-06-11  1:07                       ` Andrea Arcangeli
2003-06-11  0:54                     ` [PATCH] io stalls (was: -rc7 Re: Linux 2.4.21-rc6) Chris Mason
2003-06-11  1:06                       ` Andrea Arcangeli
2003-06-11  1:57                         ` Chris Mason
2003-06-11  2:10                           ` Andrea Arcangeli
2003-06-11 12:24                             ` Chris Mason
2003-06-11 17:42                             ` Chris Mason
2003-06-11 18:12                               ` Andrea Arcangeli
2003-06-11 18:27                                 ` Chris Mason
2003-06-11 18:35                                   ` Andrea Arcangeli
2003-06-12  1:04                                     ` [PATCH] io stalls Nick Piggin
2003-06-12  1:12                                       ` Chris Mason
2003-06-12  1:29                                       ` Andrea Arcangeli
2003-06-12  1:37                                         ` Andrea Arcangeli
2003-06-12  2:22                                         ` Chris Mason
2003-06-12  2:41                                           ` Nick Piggin
2003-06-12  2:46                                             ` Andrea Arcangeli
2003-06-12  2:49                                               ` Nick Piggin
2003-06-12  2:51                                                 ` Nick Piggin
2003-06-12  2:52                                                   ` Nick Piggin
2003-06-12  3:04                                                   ` Andrea Arcangeli
2003-06-12  2:58                                                 ` Andrea Arcangeli
2003-06-12  3:04                                                   ` Nick Piggin
2003-06-12  3:12                                                     ` Andrea Arcangeli
2003-06-12  3:20                                                       ` Nick Piggin
2003-06-12  3:33                                                         ` Andrea Arcangeli
2003-06-12  3:48                                                           ` Nick Piggin
2003-06-12  4:17                                                             ` Andrea Arcangeli
2003-06-12  4:41                                                               ` Nick Piggin
2003-06-12 16:06                                                         ` Chris Mason
2003-06-12 16:16                                                           ` Nick Piggin
2003-06-25 19:03                                               ` Chris Mason
2003-06-25 19:25                                                 ` Andrea Arcangeli
2003-06-25 20:18                                                   ` Chris Mason
2003-06-27  8:41                                                     ` write-caches, I/O stalls: MUST-FIX (was: [PATCH] io stalls) Matthias Andree
2003-06-26  5:48                                                 ` [PATCH] io stalls Nick Piggin
2003-06-26 11:48                                                   ` Chris Mason
2003-06-26 13:04                                                     ` Nick Piggin
2003-06-26 13:18                                                       ` Nick Piggin
2003-06-26 15:55                                                       ` Chris Mason
2003-06-27  1:21                                                         ` Nick Piggin
2003-06-27  1:39                                                           ` Chris Mason
2003-06-27  9:45                                                             ` Nick Piggin
2003-06-27 12:41                                                               ` Chris Mason
2003-06-12 11:57                                             ` Chris Mason
2003-06-04 10:43         ` -rc7 Re: Linux 2.4.21-rc6 Andrea Arcangeli
2003-06-04 11:01           ` Marc-Christian Petersen
2003-06-03 19:45 ` Config issue (CONFIG_X86_TSC) " Paul
2003-06-03 20:18   ` Jan-Benedict Glaw

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=3EDDDEBB.4080209@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=andrea@suse.de \
    --cc=axboe@suse.de \
    --cc=georgn@somanetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.c.p@wolk-project.de \
    --cc=marcelo@conectiva.com.br \
    --cc=matthias.mueller@rz.uni-karlsruhe.de \
    /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