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: <20161027123726.GD3175@twins.programming.kicks-ass.net>
Date:   Thu, 27 Oct 2016 14:37:26 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     David Herrmann <dh.herrmann@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        Andy Lutomirski <luto@...capital.net>,
        Jiri Kosina <jikos@...nel.org>, Greg KH <greg@...ah.com>,
        Hannes Reinecke <hare@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Arnd Bergmann <arnd@...db.de>, Tom Gundersen <teg@...m.no>,
        Josh Triplett <josh@...htriplett.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC v1 04/14] bus1: util - fixed list utility library

On Wed, Oct 26, 2016 at 09:18:00PM +0200, David Herrmann wrote:
> +		e = kmalloc_array(sizeof(*e), BUS1_FLIST_BATCH + 1, gfp);

> +#define BUS1_FLIST_BATCH (1024)

> +struct bus1_flist {
> +	union {
> +		struct bus1_flist *next;
> +		void *ptr;
> +	};
> +};

So that's an allocation of 8*(1024+1), or slightly more than 2 pages.

kmalloc will round up to the next power of two, so you'll end up with an
allocation of 16*1024, wasting a whopping 8184 bytes per such allocation
in slack space.

Please consider using 1023 or something for your batch size, 511 would
get you to exactly 1 page which would be even better.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ