Re: Optimize scsi_cmnd initialization and bug fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2005-11-23 at 14:50 -0800, Chen, Kenneth W wrote:
> struct scsi_cmnd is a fairly large data structure and is used
> to construct scsi command.  On x86-64 arch, it is 448 bytes.  
> 
> In scsi_get_command(), it is a bit too paranoid in zeroing the
> data structure.  Since most of the member variables will be
> initialized in various stage of I/O submission, i.e., in
> scsi_prep_fn, scsi_init_io, sd_init_command, scsi_init_cmd_errh,
> etc.  So instead of blindly zeroing the whole structure, initialize
> to some other value later on.  All it needs in scsi_get_command
> is to zero out a few member variables that aren't initialized in
> the I/O path.


actually I question this optimisation. memset uses the rep stosl code
sequence, which mean that the cpu can avoid write-allocate on the
cachelines in question, and just plain zero them in cache. If you
initialize the parts one by one, the cpu will need to do write-allocate
on the cachelines, and thus has double the memory bandwidth needed than
the existing case.

(not sure if all cpus are smart enough to avoid write allocate for rep
stosl, but most of the newer ones are)

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux