linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: linux@horizon.com
To: jeff@garzik.org, psusi@cfl.rr.com
Cc: htejun@gmail.com, jpiszcz@lucidpixels.com,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux@horizon.com
Subject: Re: Why is NCQ enabled by default by libata? (2.6.20)
Date: 29 Mar 2007 14:40:41 -0400	[thread overview]
Message-ID: <20070329184041.13243.qmail@science.horizon.com> (raw)
In-Reply-To: <460BF73C.5070707@cfl.rr.com>

> But when writing, what is the difference between queuing multiple tagged 
> writes, and sending down multiple untagged cached writes that complete 
> immediately and actually hit the disk later?  Either way the host keeps 
> sending writes to the disk until it's buffers are full, and the disk is 
> constantly trying to commit those buffers to the media in the most 
> optimal order.

Well, theoretically it allows more buffering, without hurting read
cacheing.

With NCQ, the drive gets the command, and then tells the host when it
wants the corresponding data.  It can ask for the data in any order
it likes, when it's decided which write will be serviced next.  So it
doesn's have to fill up its RAM with the write data.  This leaves more
RAM free for things like read-ahead.

Another trick, that I know SCSI can do and I expect NCQ can do, is that
the drive cam ask for the data for a single write in different orders.
This is particularly useful for reads, where a drive asked for blocks
100-199 can deliver blocks 150-199 first, then 100-149 when the drive
spins around.

This is, unfortunately, kind of theoretical.  I don't actually know
how hard drive cacheing algorithms work, but I assume it's mostly a
readahead cache.  The host has much more RAM than the drive, so any
block that it's read won't be requested again for a long time.  So the
drive doesn't want to keep that in cache.  But any sectors that the
drive happens to read nearby requested sectors are worth keeping.


I'm not sure it's a big deal, as 32 (tags) x 128K (largest LBA28 write
size) is 4M, only half of a typical drive's cache RAM.  But it's
possible that there's some difference.

  reply	other threads:[~2007-03-29 18:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 16:16 Why is NCQ enabled by default by libata? (2.6.20) linux
2007-03-27 16:25 ` Justin Piszcz
2007-03-27 16:41   ` linux
2007-03-27 16:44     ` Justin Piszcz
2007-03-27 16:58       ` linux
2007-03-27 17:03         ` Justin Piszcz
2007-03-28 14:42   ` Phillip Susi
2007-03-28 14:48     ` Jeff Garzik
2007-03-28 15:22       ` Andy Warner
2007-03-29 17:28       ` Phillip Susi
2007-03-29 18:40         ` linux [this message]
2007-03-29 18:51         ` Jeff Garzik
2007-03-29 21:35         ` Alan Cox
     [not found] <Pine.LNX.4.64.0703241232580.11608@p34.internal.lan>
2007-03-27  5:59 ` Jeff Garzik
2007-03-27 14:26   ` Mark Lord
2007-03-27 18:18   ` Mark Rustad
2007-03-27 18:38     ` Jeff Garzik
2007-03-27 22:12       ` Mark Rustad
2007-03-31 12:55         ` Ric Wheeler

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=20070329184041.13243.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=jpiszcz@lucidpixels.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=psusi@cfl.rr.com \
    /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;
as well as URLs for NNTP newsgroup(s).