linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	linux-m68k@lists.linux-m68k.org,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	william.kucharski@oracle.com,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	schmitzmic@gmail.com, Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <guro@fb.com>,
	Muchun Song <songmuchun@bytedance.com>,
	weixugc@google.com, Greg Thelen <gthelen@google.com>,
	David Rientjes <rientjes@google.com>,
	Paul Turner <pjt@google.com>
Subject: Re: [PATCH 01/10] mm: page_ref_add_unless() does not trace 'u' argument
Date: Thu, 9 Dec 2021 02:17:22 +0000	[thread overview]
Message-ID: <YbFnMnVxftnsxoF5@casper.infradead.org> (raw)
In-Reply-To: <CA+CK2bCLkMoJXooxGw-z+-qz20YtE96JxmDYPYM8N0f0eFb52w@mail.gmail.com>

On Wed, Dec 08, 2021 at 08:25:22PM -0500, Pasha Tatashin wrote:
> On Wed, Dec 8, 2021 at 3:55 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Wed, Dec 08, 2021 at 08:35:35PM +0000, Pasha Tatashin wrote:
> > > In other page_ref_* functions all arguments and returns are traced, but
> > > in page_ref_add_unless the 'u' argument which stands for unless boolean
> > > is not traced. However, what is more confusing is that in the tracing
> > > routine:
> > >       __page_ref_mod_unless(struct page *page, int v, int u);
> > >
> > > The 'u' argument present, but instead a return value is passed into
> > > this argument.
> > >
> > > Add a new template specific for page_ref_add_unless(), and trace all
> > > arguments and the return value.
> >
> > The special casing of '1' for device pages is going away, so NAK
> > to this user-visible change.
> 
> I can drop this patch, as it really intended to fix existing oddities
> and missing info. However, I do not really understand your NAK reason.
> Can you please explain about the special casing of "1" for device
> pages?

$ git grep page_ref_add_unless
include/linux/mm.h:     return page_ref_add_unless(page, 1, 0);
include/linux/page_ref.h:static inline bool page_ref_add_unless(struct page *page, int nr, int u)
include/linux/page_ref.h:       return page_ref_add_unless(&folio->page, nr, u);
mm/memcontrol.c:                if (!page_ref_add_unless(page, 1, 1))

'u' is always 0, except for the caller in mm/memcontrol.c:

        if (is_device_private_entry(ent)) {
                page = pfn_swap_entry_to_page(ent);
                /*
                 * MEMORY_DEVICE_PRIVATE means ZONE_DEVICE page and which have
                 * a refcount of 1 when free (unlike normal page)
                 */
                if (!page_ref_add_unless(page, 1, 1))
                        return NULL;
                return page;
        }

That special casing of ZONE_DEVICE pages is being fixed, so 'u' will
soon always be 0, and I'm sure we'll delete it as an argument.  So
there's no point in tracing what it 'used to be'.


  reply	other threads:[~2021-12-09  2:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 20:35 [PATCH 00/10] Hardening page _refcount Pasha Tatashin
2021-12-08 20:35 ` [PATCH 01/10] mm: page_ref_add_unless() does not trace 'u' argument Pasha Tatashin
2021-12-08 20:55   ` Matthew Wilcox
2021-12-09  1:25     ` Pasha Tatashin
2021-12-09  2:17       ` Matthew Wilcox [this message]
2021-12-09 15:15         ` Pasha Tatashin
2021-12-08 20:35 ` [PATCH 02/10] mm: add overflow and underflow checks for page->_refcount Pasha Tatashin
2021-12-08 20:35 ` [PATCH 03/10] mm: Avoid using set_page_count() in set_page_recounted() Pasha Tatashin
2021-12-08 20:35 ` [PATCH 04/10] mm: remove set_page_count() from page_frag_alloc_align Pasha Tatashin
2021-12-08 20:35 ` [PATCH 06/10] mm: rename init_page_count() -> page_ref_init() Pasha Tatashin
2021-12-08 20:35 ` [PATCH 07/10] mm: remove set_page_count() Pasha Tatashin
2021-12-08 20:35 ` [PATCH 08/10] mm: simplify page_ref_* functions Pasha Tatashin
2021-12-08 20:35 ` [PATCH 09/10] mm: do not use atomic_set_release in page_ref_unfreeze() Pasha Tatashin
2021-12-08 20:35 ` [PATCH 10/10] mm: use atomic_cmpxchg_acquire in page_ref_freeze() Pasha Tatashin
2021-12-08 21:05 ` [PATCH 00/10] Hardening page _refcount Matthew Wilcox
2021-12-09  1:23   ` Pasha Tatashin

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=YbFnMnVxftnsxoF5@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=geert@linux-m68k.org \
    --cc=gthelen@google.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=mingo@redhat.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pjt@google.com \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=schmitzmic@gmail.com \
    --cc=songmuchun@bytedance.com \
    --cc=vbabka@suse.cz \
    --cc=weixugc@google.com \
    --cc=william.kucharski@oracle.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