From: Jeff Layton <jlayton@kernel.org>
To: Xiubo Li <xiubli@redhat.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Ilya Dryomov <idryomov@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
ceph-devel@vger.kernel.org
Subject: Re: [PATCH] ceph: Reorder fields in 'struct ceph_snapid_map'
Date: Fri, 28 Apr 2023 07:10:46 -0400 [thread overview]
Message-ID: <3328747ef568361bd3bd5f053ec9a2c27e7f9c48.camel@kernel.org> (raw)
In-Reply-To: <f6b869ea-979c-efda-d454-8dc688d1986b@redhat.com>
On Fri, 2023-04-28 at 08:53 +0800, Xiubo Li wrote:
> On 4/28/23 02:05, Christophe JAILLET wrote:
> > Group some variables based on their sizes to reduce holes.
> > On x86_64, this shrinks the size of 'struct ceph_snapid_map' from 72 to 64
> > bytes.
> >
> > When such a structure is allocated, because of the way memory allocation
> > works, when 72 bytes were requested, 96 bytes were allocated.
> >
> > So, on x86_64, this change saves 32 bytes per allocation and has the
> > structure fit in a single cacheline.
> >
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > Using pahole
> >
> > Before:
> > ======
> > struct ceph_snapid_map {
> > struct rb_node node __attribute__((__aligned__(8))); /* 0 24 */
> > struct list_head lru; /* 24 16 */
> > atomic_t ref; /* 40 4 */
> >
> > /* XXX 4 bytes hole, try to pack */
> >
> > u64 snap; /* 48 8 */
> > dev_t dev; /* 56 4 */
> >
> > /* XXX 4 bytes hole, try to pack */
> >
> > /* --- cacheline 1 boundary (64 bytes) --- */
> > long unsigned int last_used; /* 64 8 */
> >
> > /* size: 72, cachelines: 2, members: 6 */
> > /* sum members: 64, holes: 2, sum holes: 8 */
> > /* forced alignments: 1 */
> > /* last cacheline: 8 bytes */
> > } __attribute__((__aligned__(8)));
> > ---
> > fs/ceph/mds_client.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
> > index 0598faa50e2e..2328dbda5ab6 100644
> > --- a/fs/ceph/mds_client.h
> > +++ b/fs/ceph/mds_client.h
> > @@ -355,8 +355,8 @@ struct ceph_snapid_map {
> > struct rb_node node;
> > struct list_head lru;
> > atomic_t ref;
> > - u64 snap;
> > dev_t dev;
> > + u64 snap;
> > unsigned long last_used;
> > };
> >
>
> This looks good to me. Thanks.
>
> Will apply it to the testing branch.
>
> - Xiubo
>
>
>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2023-04-28 11:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 18:05 Christophe JAILLET
2023-04-28 0:53 ` Xiubo Li
2023-04-28 11:10 ` Jeff Layton [this message]
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=3328747ef568361bd3bd5f053ec9a2c27e7f9c48.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=idryomov@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiubli@redhat.com \
/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®