[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2023112636-ouch-estrogen-1a5e@gregkh>
Date: Sun, 26 Nov 2023 15:17:15 +0000
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] kernfs: reorder 'struct kernfs_node' to save some memory
On Sun, Nov 26, 2023 at 03:49:37PM +0100, Christophe JAILLET wrote:
> 'struct kernfs_node' uses a dedicated cache, so shrinking its size is
> always a good idea.
>
> On my system, each entry is 128 bytes and their are 32 entries per pages.
> After the re-ordering, the struct is 120 bytes and 34 entries are stored
> in each page.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> The numbers below are with a allmodconfig configuration. The delta is
> related to CONFIG_DEBUG_LOCK_ALLOC and struct lockdep_map dep_map.
>
> When I checked on my system, it would have saved 372kb of RAM:
> sudo less /proc/slabinfo | grep kernf
> kernfs_node_cache 49397 49504 128 32 1 : tunables 0 0 0 : slabdata 1547 1547 0
>
> I have left flags close to the union, I *think* that they are related.
> I don't if having 'mode' here is logical or not.
I'm all for fixing up holes, but have you checked this before and after
with lockdep disabled? That's usually the biggest chunk, and can cause
alignment issues, perhaps moving that to the end would make more sense?
With that, I think everything can fit in 2 cachelines except for the
lockdep structure?
thanks,
greg k-h
Powered by blists - more mailing lists