Re: [PATCH][resend][SCSI] Reduce number of sequential pointer derefs in scsi_error.c and reduce size as well

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

 



On Sat, Nov 20, 2010 at 12:30 PM, Jesper Juhl <jj@xxxxxxxxxxxxx> wrote:
>
> Ok, I tried doing that (see patch below)

Actually, you kind of chose exactly the reverse of the functions I'd
have chosen.

Try doing the added parameter to the small static helper functions.
Those are the ones that tend to get inlined, and then the parameter
should actually result in _fewer_ pointer reloads.

So the ones like this:

>  static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)
>  {
> -       if (!scmd->device->host->hostt->eh_abort_handler)
> +       struct scsi_host_template *hostt = scmd->device->host->hostt;
> +       if (!hostt->eh_abort_handler)
>                return FAILED;
> -
> -       return scmd->device->host->hostt->eh_abort_handler(scmd);
> +       return hostt->eh_abort_handler(scmd);
>  }

Where the function is trivial, and almost all it does is to just
dereference those pointers.

If that function got the "host" pointer as an argument, it should make
it much smaller. Because half of that function is that
"scmd->device->host" lookup.

(ok, that's exaggerated, but not by much).

                Linus
--
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