linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>,
	 akpm@linux-foundation.org, peterz@infradead.org,
	willy@infradead.org,  lorenzo.stoakes@oracle.com,
	mhocko@suse.com, vbabka@suse.cz,  hannes@cmpxchg.org,
	mjguzik@gmail.com, oliver.sang@intel.com,
	 mgorman@techsingularity.net, david@redhat.com,
	peterx@redhat.com,  oleg@redhat.com, dave@stgolabs.net,
	paulmck@kernel.org, brauner@kernel.org,  dhowells@redhat.com,
	hdanton@sina.com, hughd@google.com,  lokeshgidra@google.com,
	minchan@google.com, jannh@google.com,  shakeel.butt@linux.dev,
	souravpanda@google.com, pasha.tatashin@soleen.com,
	 klarasmodin@gmail.com, corbet@lwn.net,
	linux-doc@vger.kernel.org,  linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com,
	 kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/1] fixup for mm/debug: print vm_refcnt state when dumping the vma
Date: Wed, 8 Jan 2025 07:51:20 -0800	[thread overview]
Message-ID: <CAJuCfpHd2ze7QCg3Z34a2o1ziJ1ZxonByc_=gYSGxkjV7=8mXQ@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpFKWZBLHbgH1dDNPo+6jnz4j4e9qOeKVh2Qy4JYuic71w@mail.gmail.com>

On Tue, Jan 7, 2025 at 10:57 AM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Tue, Jan 7, 2025 at 10:50 AM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
> >
> > * Suren Baghdasaryan <surenb@google.com> [241226 15:03]:
> > > vma->vm_refcnt does not exist when CONFIG_PER_VMA_LOCK=n, therefore
> > > when CONFIG_PER_VMA_LOCK=n and CONFIG_DEBUG_VM=y we need to avoid its
> > > usage in dump_vma().
> >
> > It might be worth having a function that decodes the information in the
> > vma lock and outputs a string that spells out what is going on,
>
> You mean something like "attached, 2 reader(s), 0 writer(s)" instead
> of "refcnt 0x3" ?
>
> > and
> > another that just outputs "not supported" or something.
>
> Do you mean we should report "not supported" when CONFIG_PER_VMA_LOCK=n?

Hi Liam,
I have v8 ready for posting except for this patch which I'm not clear
how you wanted to change. I thought printing the raw vm_refcnt for
debugging would be consistent with how we output other fields, like
vm_flags for example (without interpreting each bit).
 Could you please clarify, preferably with a sample output, how you
would like to see vm_refcnt printed? I can also keep this patch out of
the series for now if we are not sure yet how it should be displayed.
It's not critical and can be added later.
Thanks,
Suren.

>
> >
> > This has the benefit of spelling out the state and only having one place
> > to update in future dump_vma() changes.
> >
> > >
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes: https://lore.kernel.org/oe-kbuild-all/202412270328.HiJX1mRt-lkp@intel.com/
> > > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> > > ---
> > > Fixes https://lore.kernel.org/all/20241226170710.1159679-14-surenb@google.com/
> > > posted over mm-unstable.
> > >
> > >  mm/debug.c | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > >
> > > diff --git a/mm/debug.c b/mm/debug.c
> > > index 68b3ba3cf603..9c4cbc3733b0 100644
> > > --- a/mm/debug.c
> > > +++ b/mm/debug.c
> > > @@ -178,6 +178,7 @@ EXPORT_SYMBOL(dump_page);
> > >
> > >  void dump_vma(const struct vm_area_struct *vma)
> > >  {
> > > +#ifdef CONFIG_PER_VMA_LOCK
> > >       pr_emerg("vma %px start %px end %px mm %px\n"
> > >               "prot %lx anon_vma %px vm_ops %px\n"
> > >               "pgoff %lx file %px private_data %px\n"
> > > @@ -187,6 +188,17 @@ void dump_vma(const struct vm_area_struct *vma)
> > >               vma->anon_vma, vma->vm_ops, vma->vm_pgoff,
> > >               vma->vm_file, vma->vm_private_data,
> > >               vma->vm_flags, &vma->vm_flags, refcount_read(&vma->vm_refcnt));
> > > +#else
> > > +     pr_emerg("vma %px start %px end %px mm %px\n"
> > > +             "prot %lx anon_vma %px vm_ops %px\n"
> > > +             "pgoff %lx file %px private_data %px\n"
> > > +             "flags: %#lx(%pGv)\n",
> > > +             vma, (void *)vma->vm_start, (void *)vma->vm_end, vma->vm_mm,
> > > +             (unsigned long)pgprot_val(vma->vm_page_prot),
> > > +             vma->anon_vma, vma->vm_ops, vma->vm_pgoff,
> > > +             vma->vm_file, vma->vm_private_data,
> > > +             vma->vm_flags, &vma->vm_flags);
> > > +#endif
> > >  }
> > >  EXPORT_SYMBOL(dump_vma);
> > >
> > > --
> > > 2.47.1.613.gc27f4b7a9f-goog
> > >


      reply	other threads:[~2025-01-08 15:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26 20:03 Suren Baghdasaryan
2025-01-07 18:49 ` Liam R. Howlett
2025-01-07 18:57   ` Suren Baghdasaryan
2025-01-08 15:51     ` Suren Baghdasaryan [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='CAJuCfpHd2ze7QCg3Z34a2o1ziJ1ZxonByc_=gYSGxkjV7=8mXQ@mail.gmail.com' \
    --to=surenb@google.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dave@stgolabs.net \
    --cc=david@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hdanton@sina.com \
    --cc=hughd@google.com \
    --cc=jannh@google.com \
    --cc=kernel-team@android.com \
    --cc=klarasmodin@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lokeshgidra@google.com \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@google.com \
    --cc=mjguzik@gmail.com \
    --cc=oleg@redhat.com \
    --cc=oliver.sang@intel.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=paulmck@kernel.org \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=shakeel.butt@linux.dev \
    --cc=souravpanda@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.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