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:   Tue, 8 Sep 2020 20:32:20 -0300
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Mike Rapoport <rppt@...nel.org>
Cc:     Mateusz Nosek <mateusznosek0@...il.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: [PATCH] mm/mmu_notifier.c: micro-optimization substitute kzalloc
 with kmalloc

On Tue, Sep 08, 2020 at 09:42:45AM +0300, Mike Rapoport wrote:
> On Sun, Sep 06, 2020 at 06:06:39PM +0200, Mateusz Nosek wrote:
> > Hi,
> > 
> > I performed simple benchmarks using custom kernel module with the code
> > fragment in question 'copy-pasted' in there in both versions. In case of 1k,
> > 10k and 100k iterations the average time for kzalloc version was 5.1 and for
> > kmalloc 3.9, for each iterations number.
> > The time was measured using 'ktime_get(void)' function and the results given
> > here are in ktime_t units.
> > The machine I use has 4 core Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz CPU.
> > 
> > The performance increase happens, but as you wrote it is probably not really
> > noticeable.
> 
> I don't think that saving a few cylces of memset() in a function that
> called only on the initialization path in very particular cases is worth
> risking uninitialized variables when somebody will add a new field to
> the 'struct mmu_notifier_subscriptions' and will forget to explicitly
> set it.

Indeed, it is not a common path, it is already very expensive if code
is running here (eg it does mm_take_all_locks()).

So there is no reason at all to optimize this and risk problems down
the road.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ