From: Roger Larsson <roger.larsson@norran.net>
To: andre@linux-ide.org, linux-kernel@vger.kernel.org
Cc: Robert Cohen <robert.cohen@anu.edu.au>
Subject: [PATCH] scaling of 'max_readahead' in /proc/ide/hda/settings
Date: Thu, 4 Oct 2001 21:47:26 +0200 [thread overview]
Message-ID: <200110041952.f94JqSv14951@mailf.telia.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1433 bytes --]
I put the note first since it is important:
-----------------------------------------------
NOTE: this scaling problem might be in several drivers and possibly
also in several places in this driver. Most likely in -ac too when
enabling dynamic readahead for SCSI
-----------------------------------------------
In an earlier message I reported that dynamically changing readahead
for ide disk produced unexpected results.
I have now found the reason!
If you did cat the /proc/ide/hda/settings you would have noticed that
max_readahead was zero. But reading the code you would see that
is initialized with MAX_READAHEAD (defined to 31)
I tried to modify this and got strange results when diffing two files bigger
than RAM. Sinusoidal between very good and very poor...
But modifying the MAX_READAHEAD and recompiling worked!
Both of these are due to the same problem with scaling in ide-disk.c
mul_factor = 1
div_factor = 1024
But max_readahead is measured in pages.
When reading the file max_readahead is divided by 1024, resulting
in zero.
A value written to it is on the other hand multiplied by 1024...
So when I tried to set 511 pages readahead (2MB) it was interpreted
as 511*1024 pages (2GB !) So it tried to read ahead all of one file
before trying to read the other (but one file is bigger than my memory)
With the included patch I measure in kB and limit it at 16MB.
/RogerL
--
Roger Larsson
Skellefteå
Sweden
[-- Attachment #2: patch-2.4.11-pre2-ide_settings --]
[-- Type: text/x-diff, Size: 1468 bytes --]
*******************************************
Patch prepared by: roger.larsson@norran.net
Name of file: /home/roger/patches/patch-2.4.11-pre2-ide_settings
--- linux/drivers/ide/ide-disk.c.orig Tue Oct 2 01:05:41 2001
+++ linux/drivers/ide/ide-disk.c Thu Oct 4 21:15:36 2001
@@ -690,7 +690,7 @@
ide_add_setting(drive, "multcount", id ? SETTING_RW : SETTING_READ, HDIO_GET_MULTCOUNT, HDIO_SET_MULTCOUNT, TYPE_BYTE, 0, id ? id->max_multsect : 0, 1, 2, &drive->mult_count, set_multcount);
ide_add_setting(drive, "nowerr", SETTING_RW, HDIO_GET_NOWERR, HDIO_SET_NOWERR, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr);
ide_add_setting(drive, "breada_readahead", SETTING_RW, BLKRAGET, BLKRASET, TYPE_INT, 0, 255, 1, 2, &read_ahead[major], NULL);
- ide_add_setting(drive, "file_readahead", SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, INT_MAX, 1, 1024, &max_readahead[major][minor], NULL);
+ ide_add_setting(drive, "file_readahead", SETTING_RW, BLKFRAGET, BLKFRASET, TYPE_INTA, 0, 4096, PAGE_SIZE, 1024, &max_readahead[major][minor], NULL);
ide_add_setting(drive, "max_kb_per_request", SETTING_RW, BLKSECTGET, BLKSECTSET, TYPE_INTA, 1, 255, 1, 2, &max_sectors[major][minor], NULL);
ide_add_setting(drive, "lun", SETTING_RW, -1, -1, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL);
ide_add_setting(drive, "failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL);
reply other threads:[~2001-10-04 19:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200110041952.f94JqSv14951@mailf.telia.com \
--to=roger.larsson@norran.net \
--cc=andre@linux-ide.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robert.cohen@anu.edu.au \
/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
all inboxes | Powered by JetHome®