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

On Tue, 2024-10-22 at 15:55 +0200, Greg Kroah-Hartman wrote:
> 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:

I don't even really care, we're not likely to be changing the mac80211
debugfs code in a way that'd create (significant) conflicts. But I can
do that, thanks!

johannes

  reply	other threads:[~2024-10-22 14:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 13:18 [PATCH 1/2] debugfs: add small file operations for most files 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 ` [PATCH 1/2] debugfs: add small file operations for most files Greg Kroah-Hartman
2024-10-22 14:02   ` Johannes Berg [this message]
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=e3c39c3e7be70993c7fa07e58c2beda52ff44cb9.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=gregkh@linuxfoundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.