Project

General

Profile

Bug #8835

Speculative prefetch in ZFS not working for misaligned reads

Added by Alexander Motin almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
zfs - Zettabyte File System
Start date:
2017-11-20
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

Description

Sequential reads not aligned to block size are not detected by ZFS prefetcher as sequential, killing prefetch and severely hurting performance:

# dd if=/dev/zvol/test0/zzz of=/dev/null bs=128k
819200+0 records in
819200+0 records out
107374182400 bytes transferred in 253.025509 secs (424361096 bytes/sec)
# dd if=/dev/gpt/zzz of=/dev/null bs=128k
^C815838+0 records in
815838+0 records out
106933518336 bytes transferred in 683.459370 secs (156459218 bytes/sec)
# dd if=/dev/zvol/test0/zzz of=/dev/null bs=128k
^C486400+0 records in
486400+0 records out
63753420800 bytes transferred in 150.415240 secs (423849477 bytes/sec)
# dd if=/dev/gpt/zzz of=/dev/null bs=128k
^C22129+0 records in
22129+0 records out
2900492288 bytes transferred in 18.267249 secs (158781015 bytes/sec)

, where gpt/zzz is misaligned partition of zvol/test0/zzz.

I found that it is caused by dmu_zfetch() in case of misaligned sequential accesses being called with overlap of one block:

dmu_zfetch(fffff80198dd0ae0, 27347, 9, 1)
dmu_zfetch(fffff80198dd0ae0, 27355, 9, 1)
dmu_zfetch(fffff80198dd0ae0, 27363, 9, 1)
dmu_zfetch(fffff80198dd0ae0, 27371, 9, 1)
dmu_zfetch(fffff80198dd0ae0, 27379, 9, 1)
dmu_zfetch(fffff80198dd0ae0, 27387, 9, 1)

History

#2

Updated by Electric Monk over 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 5cb8d943bc8513c6230589aad5a409d58b0297cb

commit  5cb8d943bc8513c6230589aad5a409d58b0297cb
Author: Alexander Motin <mav@FreeBSD.org>
Date:   2018-01-18T17:07:03.000Z

    8835 Speculative prefetch in ZFS not working for misaligned reads
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Allan Jude <allanjude@freebsd.org>
    Approved by: Gordon Ross <gwr@nexenta.com>

Also available in: Atom PDF