lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=_r2YvDv0wj6qY_DqXntvHwfKNavTv8AKF+iXm@mail.gmail.com>
Date:	Sat, 20 Nov 2010 16:03:35 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Jesper Juhl <jj@...osbits.net>
Cc:	linux-scsi@...r.kernel.org,
	"James E.J. Bottomley" <James.Bottomley@...e.de>,
	linux-kernel@...r.kernel.org, Eric Youngdale <eric@...ante.org>,
	"David S. Miller" <davem@...emloft.net>,
	Mike Anderson <andmike@...ibm.com>,
	Russell King <rmk@....linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH][resend][SCSI] Reduce number of sequential pointer derefs
 in scsi_error.c and reduce size as well

On Sat, Nov 20, 2010 at 12:30 PM, Jesper Juhl <jj@...osbits.net> 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ