From: Greg KH <gregkh@linuxfoundation.org>
To: Faiyaz Mohammed <faiyazm@codeaurora.org>
Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com,
iamjoonsoo.kim@lge.com, akpm@linux-foundation.org,
vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org,
glittao@gmail.com, vinmenon@codeaurora.org
Subject: Re: [PATCH v7] mm: slub: move sysfs slab alloc/free interfaces to debugfs
Date: Tue, 25 May 2021 13:54:49 +0200 [thread overview]
Message-ID: <YKzlia5b/vaDaul9@kroah.com> (raw)
In-Reply-To: <7324d56f-c5fe-05fa-55f2-7dd2dbf9bce0@codeaurora.org>
On Tue, May 25, 2021 at 02:27:15PM +0530, Faiyaz Mohammed wrote:
>
>
> On 5/25/2021 1:23 PM, Greg KH wrote:
> > On Tue, May 25, 2021 at 01:08:05PM +0530, Faiyaz Mohammed wrote:
> >> alloc_calls and free_calls implementation in sysfs have two issues,
> >> one is PAGE_SIZE limitiation of sysfs and other is it does not adhere
> >> to "one value per file" rule.
> >>
> >> To overcome this issues, move the alloc_calls and free_calls implemeation
> >> to debugfs.
> >>
> >> Rename the alloc_calls/free_calls to alloc_traces/free_traces,
> >> to be inline with what it does.
> >>
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> >> Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org>
> >> ---
> >> changes in V7:
> >> - Drop the older alloc_calls and free_calls interface.
> >> changes in v6:
> >> - https://lore.kernel.org/linux-mm/1621341949-26762-1-git-send-email-faiyazm@codeaurora.org/
> >>
> >> changes in v5:
> >> - https://lore.kernel.org/linux-mm/1620296523-21922-1-git-send-email-faiyazm@codeaurora.org/
> >>
> >> changes in v4:
> >> - https://lore.kernel.org/linux-mm/1618583239-18124-1-git-send-email-faiyazm@codeaurora.org/
> >>
> >> changes in v3:
> >> - https://lore.kernel.org/linux-mm/1617712064-12264-1-git-send-email-faiyazm@codeaurora.org/
> >>
> >> changes in v2:
> >> - https://lore.kernel.org/linux-mm/3ac1d3e6-6207-96ad-16a1-0f5139d8b2b5@codeaurora.org/
> >>
> >> changes in v1:
> >> - https://lore.kernel.org/linux-mm/1610443287-23933-1-git-send-email-faiyazm@codeaurora.org/
> >>
> >> include/linux/slub_def.h | 8 ++
> >> mm/slab_common.c | 9 ++
> >> mm/slub.c | 353 ++++++++++++++++++++++++++++++++++-------------
> >> 3 files changed, 276 insertions(+), 94 deletions(-)
> >>
> >> diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
> >> index dcde82a..b413ebe 100644
> >> --- a/include/linux/slub_def.h
> >> +++ b/include/linux/slub_def.h
> >> @@ -159,6 +159,14 @@ static inline void sysfs_slab_release(struct kmem_cache *s)
> >> }
> >> #endif
> >>
> >> +#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_SLUB_DEBUG)
> >> +#define SLAB_SUPPORTS_DEBUGFS
> >> +void debugfs_slab_release(struct kmem_cache *);
> >> +#else
> >> +static inline void debugfs_slab_release(struct kmem_cache *s)
> >> +{
> >> +}
> >> +#endif
> >> void object_err(struct kmem_cache *s, struct page *page,
> >> u8 *object, char *reason);
> >>
> >> diff --git a/mm/slab_common.c b/mm/slab_common.c
> >> index a4a5714..873dd79 100644
> >> --- a/mm/slab_common.c
> >> +++ b/mm/slab_common.c
> >> @@ -455,6 +455,9 @@ static void slab_caches_to_rcu_destroy_workfn(struct work_struct *work)
> >> #else
> >> slab_kmem_cache_release(s);
> >> #endif
> >> +#ifdef SLAB_SUPPORTS_DEBUGFS
> >> + debugfs_slab_release(s);
> >> +#endif
> >
> > Why do you need these #ifdef if your slub_dev.h file already provides an
> > "empty" function for this?
> >
> We are not including slub_def.h directly. mm/slab.h includes the
> slub_def.h if CONFIG_SLUB enable,
>
> from mm/slab.h
> #ifdef CONFIG_SLAB
> #include <linux/slab_def.h>
> #endif
>
> #ifdef CONFIG_SLUB
> #include <linux/slub_def.h>
> #endif
>
> so if CONFIG_SLAB is enable then mm/slab.h includes slab_def.h, to avoid
> undefined reference error added SLAB_SUPPORTS_DEBUGFS like
> SLAB_SUPPORTS_SYSFS.
Ick, ok, messy code, I'll stop complaining now if this really is the
only way to do it (still feels wrong to me...)
greg k-h
next prev parent reply other threads:[~2021-05-25 11:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 7:38 [PATCH v7] mm: slub: move sysfs slab alloc/free interfaces to debugfs Faiyaz Mohammed
2021-05-25 7:53 ` Greg KH
2021-05-25 8:57 ` Faiyaz Mohammed
2021-05-25 11:54 ` Greg KH [this message]
2021-05-26 11:03 ` Vlastimil Babka
2021-05-26 15:06 ` Faiyaz Mohammed
2021-05-26 15:07 ` Vlastimil Babka
2021-05-26 11:38 ` Vlastimil Babka
2021-05-26 11:48 ` Greg KH
2021-05-26 12:13 ` Vlastimil Babka
2021-05-31 7:11 ` Faiyaz Mohammed
2021-05-31 8:19 ` Vlastimil Babka
2021-05-31 9:50 ` Faiyaz Mohammed
2021-05-31 6:55 ` Faiyaz Mohammed
2021-05-31 9:55 ` Vlastimil Babka
2021-05-31 11:07 ` Faiyaz Mohammed
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=YKzlia5b/vaDaul9@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=faiyazm@codeaurora.org \
--cc=glittao@gmail.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
--cc=vinmenon@codeaurora.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;
as well as URLs for NNTP newsgroup(s).