All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Tejun Heo <tj@kernel.org>,
	jmoyer@redhat.com, axboe@fb.com, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Subject: Re: [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices
Date: Thu, 11 Aug 2016 22:01:58 -0400	[thread overview]
Message-ID: <yq1mvkipwx5.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <CAGnHSEn3pXR33Ju+mr0DYdE0G7kNhxNCbvocX1pZXvYfxx5+3A@mail.gmail.com> (Tom Yan's message of "Thu, 11 Aug 2016 17:30:59 +0800")

>>>>> "Tom" == Tom Yan <tom.ty89@gmail.com> writes:

Hey Tom,

Tom> Shouldn't we use Maximum Transfer Length to derive max_sectors (and
Tom> get rid of the almost useless max_dev_sectors)?

MAXIMUM TRANSFER LENGTH could be gigabytes. Some disks report it as the
full capacity of the device.

Again, the point of max_hw_sectors and max_dev_sectors is to enforce the
hard limits of controller and device respectively. Nothing else.

max_sectors is a soft limit for filesystem read/write requests and is
chosen to be a sane default for common workloads. It can be bumped (up
to the smaller of the hard limits) if the user so desires.

Tom> Honestly it looks pretty non-sensical to me that the SCSI disk
Tom> driver uses Optimal Transfer Length for max_sectors.

OPTIMAL TRANSFER LENGTH is there to address a very specific problem,
namely avoiding partial stripe writes on RAID arrays.

For almost all other device classes it is not reported and it makes no
sense to do so. For those remaining devices BLK_DEF_MAX_SECTORS comes
into play.

Tom> But the biggest problem isn't on bumping it, but the value picked
Tom> is totally irrational for a general default. I mean, given that it
Tom> was 1024 (512k), try to double it? Fine. Try to quadruple it?
Tom> Alright.  We'll need to deal with some alignment / boundary issue
Tom> (like the typical 65535 vs 65536 case)? Okay let's do it. But
Tom> what's the sense in picking a random RAID configuartion as the base
Tom> to decide the default?

I agree that the new default is completely arbitrary. And I think there
was a bit of controversy at the time. However, the numbers were
compelling so the change went in.

We are open to a discussion about what the default should be. But it
involves backing the discussion up with solid data.

Tom> So we should use also SCSI_DEFAULT_MAX_SECTORS in the SCSI disk
Tom> driver as fallback for max_sectors. If the value is considered to
Tom> low even as a safe fallback, then it should be bumped
Tom> appropriately. (Or we might want to replace it with
Tom> BLK_DEF_MAX_SECTORS everywhere in the SCSI layer, that said, after
Tom> the value is fixed.)

SCSI_DEFAULT_MAX_SECTORS is there to provide a safe max for legacy SCSI
controller drivers that haven't been updated or tested with larger
transfers. It has nothing to do with sd drive limits or block layer
defaults.

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2016-08-12  2:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 14:45 [PATCH v2 1/2] libata-scsi: set max_hw_sectors again only when dev->max_sectors is set tom.ty89
2016-08-09 14:45 ` [PATCH v2 2/2] libata-core: do not set dev->max_sectors for LBA48 devices tom.ty89
2016-08-09 16:50   ` Sergei Shtylyov
2016-08-10  4:10   ` Tejun Heo
2016-08-10  8:32     ` Tom Yan
2016-08-10 15:22       ` Tejun Heo
2016-08-11  3:37       ` Martin K. Petersen
2016-08-11  9:30         ` Tom Yan
2016-08-12  2:01           ` Martin K. Petersen [this message]
2016-08-12  5:18             ` Tom Yan
2016-08-12  8:17               ` Tom Yan
2016-08-12 21:06               ` Martin K. Petersen
2016-08-12  9:16             ` One Thousand Gnomes
2016-08-12 21:17               ` Martin K. Petersen

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=yq1mvkipwx5.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=axboe@fb.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=tj@kernel.org \
    --cc=tom.ty89@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.