All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: Nate Iverson <niverson@pillardata.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: Where is max_scsi_adapter_scatter_gather_elements found in the Linux source code?
Date: Wed, 22 Sep 2004 14:44:00 +1000	[thread overview]
Message-ID: <41510310.4040500@torque.net> (raw)
In-Reply-To: <16236EEEF4D4264DA31C2E35E3607CFE08EA23@coex02.trans.corp>

Nate Iverson wrote:
>>I'm resending this becuase I missed the http links are treated as SPAM thing.
>>
>>In en.tldp.org/HOWTO/SCSI-Generic-HOWTO/dio.html it says 
>>
>>Notes
>>
>>[1]	Unfortunately that setup time is large enough in some 
 >> versions of the lk 2.4 series to adversely impact direct IO
 >> performance. Also memory malloc()-ed in the user space
 >> tends to be made up of discontinuous pages seen from the
 >> SCSI adapter. This requires the sg driver to build heavily
 >> splintered scatter gather lists which is less than desirable.
 >> This limits the maximum transfer size to
 >> [(max_scsi_adapter_scatter_gather_elements - 1) * PAGE_SIZE].
 >> [This is a _different_ scatter gather mechanism to that which
 >> the user sees in the sg interface based on iovec.]
>>
>>
>>I have grepped through the Linux source code, but I can't find 
 >> max_scsi_adapter_scatter_gather_elements. The max data transfer
 >> appears to be ~1MB on my kernel. I'm using Redhat 9 with a
 >> custom kernel I built.(4.20-8_SPARSE_16). I would like to double
 >> the max tranfer size so my target device can be forced to do
 >> iterations on large read and write command. I'm assuming changing
 >> PAGE_SIZE would cause problems for other modules.

Natham,
The name inside the SCSI mid-level is "sg_tablesize" and it is
set by the low level driver (e.g. aic7xxx). The maximum value
is 256 (or 255?) and may have been trimmed down to 128 in lk 2.6 .
I was trying to use a more descriptive name, sorry for the
confusion.

In lk 2.4 you can see this value with:
# cd /proc/scsi/sg
# cat host_hdr hosts

In lk 2.6 you can see this value with:
# cat /sys/class/scsi_host/host<host_num>/sg_tablesize

PAGE_SIZE cannot practically be changed (it's 4 KB for i386
architecture) although there is "big" page support in lk 2.6
(but it won't help here). I have since been told that the scatter
gather setup time per element (in a typical low level driver) does
not take much time, but if the kernel has to build and tear down
a large scatter gather list per IO, that will slow throughput.
To get larger amounts of data per IO through
quickly I would suggest that you use mmap-ed IO since the sg
driver's per fd reserve buffer is built from 32 KB elements (and
you can change that [in sg.h]) giving a maximum transfer size
of around 8MB. mmap-ed IO in sg is also the fastest in my tests.

Doug Gilbert


  reply	other threads:[~2004-09-22  4:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-21 17:05 Where is max_scsi_adapter_scatter_gather_elements found in the Linux source code? Nate Iverson
2004-09-22  4:44 ` Douglas Gilbert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-21 16:58 Nate Iverson

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=41510310.4040500@torque.net \
    --to=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=niverson@pillardata.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.