mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: gregkh@linuxfoundation.org, andrea.righi@canonical.com,
	ast@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] kernfs: Rearrange kernfs_node fields to reduce its size on 64bit
Date: Wed, 10 Jan 2024 08:26:49 -1000	[thread overview]
Message-ID: <ZZ7haRXNwyxDSQum@slm.duckdns.org> (raw)
In-Reply-To: <CAMuHMdWD==XWQrcZVfxaL0wSjG5hFPoUubpi6mjrJSPU+nOoJg@mail.gmail.com>

On Wed, Jan 10, 2024 at 04:18:36PM +0100, Geert Uytterhoeven wrote:
> Hi Tejun,
> 
> On Tue, Jan 9, 2024 at 10:49 PM Tejun Heo <tj@kernel.org> wrote:
> > Moving .flags and .mode right below .hash makes kernfs_node smaller by 8
> > bytes on 64bit.
> >
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> 
> Thanks for your patch!
> 
> > --- a/include/linux/kernfs.h
> > +++ b/include/linux/kernfs.h
> > @@ -206,6 +206,9 @@ struct kernfs_node {
> >
> >         const void              *ns;    /* namespace tag */
> >         unsigned int            hash;   /* ns + name hash */
> > +       unsigned short          flags;
> > +       umode_t                 mode;
> > +
> >         union {
> >                 struct kernfs_elem_dir          dir;
> >                 struct kernfs_elem_symlink      symlink;
> > @@ -220,8 +223,6 @@ struct kernfs_node {
> >          */
> >         u64                     id;
> >
> > -       unsigned short          flags;
> > -       umode_t                 mode;
> >         struct kernfs_iattrs    *iattr;
> 
> Note that there is now a hole at the end of the structure on 32-bit
> architectures
> where the alignment of u64 is 8 bytes.
> 
> Hence, sizeof(struct kernfs_node) grew from 104 to 112 bytes on (at
> least) arm32 and rv32.
> It did shrink by 8 bytes on amd64, arm64, mips64, and rv64.
> Size is unchanged on ia32, m68k and sh.
> 
> I didn't check any other architectures.

Ah, thanks. I'll shuffle things a bit more so that the size doesn't increase
for 32bits.

-- 
tejun

  reply	other threads:[~2024-01-10 18:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 21:48 [PATCHSET driver-core-next] kernfs: Protect kernfs_find_and_get_node_by_id() with RCU Tejun Heo
2024-01-09 21:48 ` [PATCH 1/3] Revert "kernfs: convert kernfs_idr_lock to an irq safe raw spinlock" Tejun Heo
2024-01-09 21:48 ` [PATCH 2/3] kernfs: Rearrange kernfs_node fields to reduce its size on 64bit Tejun Heo
2024-01-10 15:18   ` Geert Uytterhoeven
2024-01-10 18:26     ` Tejun Heo [this message]
2024-01-10 18:28   ` [PATCH v2 " Tejun Heo
2024-01-09 21:48 ` [PATCH 3/3] kernfs: RCU protect kernfs_nodes and avoid kernfs_idr_lock in kernfs_find_and_get_node_by_id() Tejun Heo
2024-01-10  7:40 ` [PATCHSET driver-core-next] kernfs: Protect kernfs_find_and_get_node_by_id() with RCU Andrea Righi
2024-01-10 15:52 ` Greg KH
2024-01-12 12:34 ` Geert Uytterhoeven

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=ZZ7haRXNwyxDSQum@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=andrea.righi@canonical.com \
    --cc=ast@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®