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: <2024100943-snuggle-undoing-811b@gregkh>
Date: Wed, 9 Oct 2024 19:33:52 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Johannes Berg <johannes.berg@...el.com>
Subject: Re: [RFC PATCH 1/2] debugfs: add small file operations for most files

On Wed, Oct 09, 2024 at 06:13:39PM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@...el.com>
> 
> As struct file_operations is really big, but (most) debugfs
> files only use simple_open, read and write, and don't need
> anything else, this wastes a lot of space for NULL pointers.

You added llseek too, I'm guessing you need/want that?

> Add a struct debugfs_short_fops and some bookkeeping code in
> debugfs so that users can use that with debugfs_create_file()
> using _Generic to figure out which function to use.

That's crazy, but nice work!

> Converting mac80211 to use it where possible saves quite a
> bit of space:
> 
> 1010127  205064    1220 1216411  128f9b net/mac80211/mac80211.ko (before)
>  981199  205064    1220 1187483  121e9b net/mac80211/mac80211.ko (after)
> -------
>  -28928 = ~28KiB
> 
> With a marginal space cost in debugfs:
> 
>    8701	    550	     16	   9267	   2433	fs/debugfs/inode.o (before)
>   25233	    325	     32	  25590	   63f6	fs/debugfs/file.o  (before)
>    8914	    558	     16	   9488	   2510	fs/debugfs/inode.o (after)
>   25380	    325	     32	  25737	   6489	fs/debugfs/file.o  (after)
> ---------------
>    +360      +8
> 
> (All on x86-64)
> 
> A simple spatch suggests there are more than 300 instances,
> not even counting the ones hidden in macros like in mac80211,
> that could be trivially converted, for additional savings of
> about 240 bytes for each.
> 
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
> ---
>  fs/debugfs/file.c       | 100 ++++++++++++++++++++++++++++------------
>  fs/debugfs/inode.c      |  63 +++++++++++--------------
>  fs/debugfs/internal.h   |   6 +++
>  include/linux/debugfs.h |  60 ++++++++++++++++++++++--
>  4 files changed, 159 insertions(+), 70 deletions(-)

That's real savings so I'm all for it unless someone else objects?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ