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: <20240828222759.GG2130480@google.com>
Date: Wed, 28 Aug 2024 22:27:59 +0000
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: Luis Chamberlain <mcgrof@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Matthew Maurer <mmaurer@...gle.com>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Wedson Almeida Filho <wedsonaf@...il.com>,
	Gary Guo <gary@...yguo.net>, Petr Pavlu <petr.pavlu@...e.com>,
	Neal Gompa <neal@...pa.dev>, Hector Martin <marcan@...can.st>,
	Janne Grunau <j@...nau.net>, Asahi Linux <asahi@...ts.linux.dev>,
	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-modules@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 06/19] gendwarfksyms: Add a cache for processed DIEs

On Thu, Aug 29, 2024 at 03:15:02AM +0900, Masahiro Yamada wrote:
> On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen <samitolvanen@...gle.com> wrote:
> > +static int append_item(struct die *cd, struct die_fragment **res)
> > +{
> > +       struct die_fragment *prev;
> > +       struct die_fragment *df;
> > +
> > +       df = malloc(sizeof(struct die_fragment));
> > +       if (!df) {
> > +               error("malloc failed");
> > +               return -1;
> > +       }
> > +
> > +       df->type = EMPTY;
> > +       df->next = NULL;
> > +
> > +       prev = cd->list;
> > +       while (prev && prev->next)
> > +               prev = prev->next;
> 
> 
> 
> So, this entirely traverses the singly-linked list
> every time a new item is appended to the tail.
> 
> 
> In my analysis, this while loop iterates for thousands
> of times in total for emitting each export symbol.
> 
> 
> Why isn't this list_add_tail()?

Good catch, I'll fix this in the next version. Keeping track of the
last element should be sufficient, but I agree, using the existing
list implementation is probably cleaner. Thanks!

Sami

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ