Re: Why is NCQ enabled by default by libata? (2.6.20)



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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [OT] Interview with Con Kolivas on Linux failures
    ... On one side there are people who point out that programs often allocate memory that goes unused most of the time, and this memory can be better used as disk cache. ... The ultimate result of this was the addition of a "swappiness" knob to 2.6 kernels to allow people to tune this to their taste. ... I haven't felt the need to tweak swappiness on my desktop machine from the default of 60, but it's also got 1 gigabyte of RAM. ...
    (Debian-User)
  • Re: Good settings for BlockRead
    ... > before each test to clear out the disk cache. ... with 512meg memory memory and a 2 gig file using blockread ... The interesting this is that if I force 300 mb of physical ram free ...
    (comp.lang.pascal.delphi.misc)
  • Re: 2.6 vm/elevator loading down disks where 2.4 does not
    ... disk more often, as they had less RAM for cache. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Re-read an image
    ... Matlab, but geez, that gets complicated. ... This is not the same as clearing the cache. ... clear the disk cache, however I don't know how without digging into ... it's most likely not in ram memory. ...
    (comp.soft-sys.matlab)
  • Re: Ram Drive
    ... > its cache in between that and your program, ... If it is cacheing all these temporary files, ... rattling away as the temporary files are written out to disk, ...
    (microsoft.public.windowsxp.general)