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] [day] [month] [year] [list]
Date:   Wed, 24 Mar 2021 11:33:55 +0000
From:   Alexander Lobakin <alobakin@...me>
To:     Krzysztof Wilczyński <kw@...ux.com>
Cc:     Alexander Lobakin <alobakin@...me>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Jingoo Han <jingoohan1@...il.com>,
        Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
        Rob Herring <robh@...nel.org>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND] PCI: dwc: put struct dw_pcie::{ep,pp} into a union to reduce its size

From: Krzysztof Wilczyński <kw@...ux.com>
Date: Wed, 24 Mar 2021 02:31:42 +0100

> Hi Alexander,

Hi!

> Thank you for sending the patch over!
>
> > A single dw_pcie entity can't be a root complex and an endpoint at
> > the same time.
>
> Nice catch!
>
> A small nitpick: this would be Root Complex and Endpoint, as it's
> customary to capitalise these.
>
> Also, if you could capitalise the subject line - it could also perhaps
> be simplified to something like, for example:
>
>   Optimize struct dw_pcie to reduce its size
>
> Feel free to ignore both suggestions, as these are just nitpicks.

They are both correct, so I can send a v2 if this one wont't be
picked to the tree, let's say, this week.

> > We can use this to reduce the size of dw_pcie by 80, from 280 to 200
> > bytes (on x32, guess more on x64), by putting the related embedded
> > structures (struct pcie_port and struct dw_pcie_ep) into a union.
>
> [...]
> > -	struct pcie_port	pp;
> > -	struct dw_pcie_ep	ep;
> > +	union {
> > +		struct pcie_port	pp;
> > +		struct dw_pcie_ep	ep;
> > +	};
> [...]
>
> How did you measure the difference?  Often, people include pahole output
> for the "before" and "after", so to speak, to showcase the difference
> and/or improvement.  Do you have something like that handy?

I didn't use pahole to measure the difference, just printed sizeofs
for the structures "before" and "after". But I can get pahole's
output and include it in v2 to make commit message more useful.

> Krzysztof

Thanks!
Al

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ