From: Jeff Layton <jlayton@kernel.org>
To: "Luís Henriques" <lhenriques@suse.de>, xiubli@redhat.com
Cc: idryomov@gmail.com, vshankar@redhat.com, ceph-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] ceph: move to a dedicated slabcache for ceph_cap_snap
Date: Fri, 18 Feb 2022 13:56:13 -0500 [thread overview]
Message-ID: <c00f33d0cae058087a3ee686e4df8163d2d92a3a.camel@kernel.org> (raw)
In-Reply-To: <8735kghwnw.fsf@brahms.olymp>
On Fri, 2022-02-18 at 18:11 +0000, Luís Henriques wrote:
> xiubli@redhat.com writes:
>
> > From: Xiubo Li <xiubli@redhat.com>
> >
> > There could be huge number of capsnap queued in a short time, on
> > x86_64 it's 248 bytes, which will be rounded up to 256 bytes by
> > kzalloc. Move this to a dedicated slabcache to save 8 bytes for
> > each.
> >
> > For the kmalloc-256 slab cache, the actual size will be 512 bytes:
> > kmalloc-256 21797 74656 512 32 4 : tunables, etc
> >
> > For a dedicated slab cache the real size is 312 bytes:
> > ceph_cap_snap 0 0 312 52 4 : tunables, etc
> >
> > So actually we can save 200 bytes for each.
> >
> > Signed-off-by: Xiubo Li <xiubli@redhat.com>
> > ---
> > fs/ceph/snap.c | 5 +++--
> > fs/ceph/super.c | 7 +++++++
> > fs/ceph/super.h | 2 +-
> > include/linux/ceph/libceph.h | 1 +
> > 4 files changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
> > index b41e6724c591..c787775eaf2a 100644
> > --- a/fs/ceph/snap.c
> > +++ b/fs/ceph/snap.c
> > @@ -482,7 +482,7 @@ static void ceph_queue_cap_snap(struct ceph_inode_info *ci)
> > struct ceph_buffer *old_blob = NULL;
> > int used, dirty;
> >
> > - capsnap = kzalloc(sizeof(*capsnap), GFP_NOFS);
> > + capsnap = kmem_cache_alloc(ceph_cap_snap_cachep, GFP_NOFS);
>
> Unfortunately, this is causing issues in my testing. Looks like there are
> several fields that are assumed to be initialised to zero. I've seen two
> BUGs so far, in functions ceph_try_drop_cap_snap (capsnap->cap_flush.tid > 0)
> and __ceph_finish_cap_snap (capsnap->writing).
>
> I guess you'll have to either zero out all that memory, or manually
> initialise the fields (not sure which ones really require that).
Good catch. That memory is expected to be zeroed. I switched it to use
kmem_cache_zalloc in testing branch, which should fix this. Please let
me know if it doesn't.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2022-02-18 18:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 12:23 [PATCH 0/3] ceph: fix cephfs rsync kworker high load issue xiubli
2022-02-15 12:23 ` [PATCH 1/3] ceph: move to a dedicated slabcache for ceph_cap_snap xiubli
2022-02-15 15:29 ` Jeff Layton
2022-02-16 14:58 ` Jeff Layton
2022-02-17 0:54 ` Xiubo Li
2022-02-18 18:11 ` Luís Henriques
2022-02-18 18:56 ` Jeff Layton [this message]
2022-02-15 12:23 ` [PATCH 2/3] ceph: move kzalloc under i_ceph_lock with GFP_ATOMIC flag xiubli
2022-02-15 16:57 ` Jeff Layton
2022-02-16 0:29 ` Xiubo Li
2022-02-15 12:23 ` [PATCH 3/3] ceph: do no update snapshot context when there is no new snapshot xiubli
2022-02-15 17:05 ` Jeff Layton
2022-02-16 0:30 ` Xiubo Li
2022-02-15 18:35 ` Jeff Layton
2022-02-16 0:36 ` Xiubo Li
2022-02-17 3:03 ` Yan, Zheng
2022-02-17 10:55 ` Jeff Layton
2022-02-17 15:28 ` Yan, Zheng
2022-02-18 1:46 ` Xiubo Li
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=c00f33d0cae058087a3ee686e4df8163d2d92a3a.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=lhenriques@suse.de \
--cc=vshankar@redhat.com \
--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