mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH 1/2] debugfs: add small file operations for most files
Date: Tue, 22 Oct 2024 15:55:29 +0200	[thread overview]
Message-ID: <2024102201-pummel-mournful-d349@gregkh> (raw)
In-Reply-To: <20241022151838.26f9925fb959.Ia80b55e934bbfc45ce0df42a3233d34b35508046@changeid>

On Tue, Oct 22, 2024 at 03:18:34PM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> As struct file_operations is really big, but (most) debugfs
> files only use simple_open, read, write and perhaps seek, and
> don't need anything else, this wastes a lot of space for NULL
> pointers.
> 
> 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.
> 
> 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@intel.com>

I imagine you want to take this through the wireless tree for the second
patch, so feel free to do that and add:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

thanks!

greg k-h

  parent reply	other threads:[~2024-10-22 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 13:18 Johannes Berg
2024-10-22 13:18 ` [PATCH 2/2] wifi: mac80211: convert debugfs files to short fops Johannes Berg
2024-10-22 13:55 ` Greg Kroah-Hartman [this message]
2024-10-22 14:02   ` [PATCH 1/2] debugfs: add small file operations for most files Johannes Berg
2024-11-25 12:37 ` Geert Uytterhoeven
2024-11-26  8:38   ` Geert Uytterhoeven
2024-11-26  9:37     ` Johannes Berg
2024-11-26 14:16       ` Geert Uytterhoeven
2024-11-26 14:22         ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024102201-pummel-mournful-d349@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®