Re: [PATCH v2 1/3] scsi_cmnd: Introduce scsi_transfer_length helper

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

 



On Thu, 2014-06-26 at 16:53 +0200, Bart Van Assche wrote:
> On 06/11/14 11:09, Sagi Grimberg wrote:
> > +	return xfer_len + (xfer_len >> ilog2(sector_size)) * 8;
> 
> Sorry that I just noticed this now, but why is a shift-right and ilog2()
> used in the above expression instead of just dividing the transfer
> length by the sector size ?

It's a performance thing.  Division is really slow on most CPUs.
However, we know the divisor is a power of two so we re-express the
division as a shift, which the processor can do really fast.

James


--
To unsubscribe from this list: 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