Re: [PATCH v3 11/26] mm/swapfile: Annotate static information into meminspect
From: Mukesh Ojha
Date: Wed Jul 08 2026 - 15:06:47 EST
On Wed, Jul 08, 2026 at 08:47:51AM +0100, Lorenzo Stoakes wrote:
> On Wed, Jul 08, 2026 at 11:01:50AM +0530, Mukesh Ojha wrote:
> > From: Eugen Hristev <ehristev@xxxxxxxxxx>
> >
> > Annotate vital static information into inspection table:
> > - nr_swapfiles
> >
> > Information on these variables is stored in a dedicated meminspect
> > section.
> >
> > Signed-off-by: Eugen Hristev <eugen.hristev@xxxxxxxxxx>
> > Signed-off-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>
> > ---
> > mm/swapfile.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/mm/swapfile.c b/mm/swapfile.c
> > index a602e5820513..d480727e4987 100644
> > --- a/mm/swapfile.c
> > +++ b/mm/swapfile.c
> > @@ -42,6 +42,7 @@
> > #include <linux/suspend.h>
> > #include <linux/zswap.h>
> > #include <linux/plist.h>
> > +#include <linux/meminspect.h>
> >
> > #include <asm/tlbflush.h>
> > #include <linux/leafops.h>
> > @@ -65,6 +66,7 @@ static void move_cluster(struct swap_info_struct *si,
> > */
> > static DEFINE_SPINLOCK(swap_lock);
> > static unsigned int nr_swapfiles;
> > +MEMINSPECT_SIMPLE_ENTRY(nr_swapfiles);
>
> Now the EXPORT_SYMBOL_GPL() is an EXPORT_SYMBOL() in effect no?
The whole reason we had to tag most of the MM symbols is that
the crash tool looks for this information while launching itself.
e.g.,
./crash --no_modules --no_panic --no_kmem_cache --zero_excluded ./vmlinux ./minidump.elf
>
> > atomic_long_t nr_swap_pages;
> > /*
> > * Some modules use swappable objects and may try to swap them out under
> >
> > --
> > 2.53.0
> >
--
-Mukesh Ojha