Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ilya.gladyshev@linux.dev
To: "Kiryl Shutsemau" <kirill@shutemov.name>
Cc: ivgorbunov@me.com, Liam.Howlett@oracle.com,
	akpm@linux-foundation.org, apopple@nvidia.com,
	artem.kuzin@huawei.com, baolin.wang@linux.alibaba.com,
	david@kernel.org, foxido@foxido.dev, harry.yoo@oracle.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	lorenzo.stoakes@oracle.com, mhocko@suse.com,
	muchun.song@linux.dev, rppt@kernel.org, surenb@google.com,
	torvalds@linuxfoundation.org, vbabka@suse.cz,
	willy@infradead.org, yuzhao@google.com, ziy@nvidia.com,
	pfalcato@suse.de
Subject: Re: [PATCH v3 1/2] mm: drop page refcount zero state semantics
Date: Thu, 04 Jun 2026 12:47:49 +0000	[thread overview]
Message-ID: <431c8a974d685d547b0ba1ebe887ce200291e044@linux.dev> (raw)
In-Reply-To: <aiFZ57eRrCcWmS6E@thinkstation>

> 
> On Thu, Jun 04, 2026 at 10:15:12AM +0000, ilya.gladyshev@linux.dev wrote:
> 
> > 
> > @@ -115,8 +120,14 @@ static inline void init_page_count(struct page *page)
> >  set_page_count(page, 1);
> >  }
> >  
> >  +static inline void set_page_count_as_frozen(struct page *page)
> >  +{
> >  + set_page_count(page, 0);
> >  +}
> >  +
> > 
> This name is strange. Maybe something like init_page_count_frozen()?

TBH I slightly dislike "init" in this naming, but it's probably better
than our proposal. Maybe set_page_count_frozen()?

> And don't you want to update it in patch 2 to set the bit?

My bad, apologies. Don't even know how it passed stress-tests...

> > 
> > static inline void page_ref_add(struct page *page, int nr)
> >  {
> >  + VM_BUG_ON(__page_count_is_frozen(page_count(page)));
> > 
> Hm. These VM_BUG_ONs are useless after patch 2.
> 
> In patch 2, you make __page_count_is_frozen() check the frozen bit and
> page_count() masks out frozen bit.
> 
> I guess you want to read raw ref number here, no?

Yes, indeed. I will rewrite with __page_count_is_frozen(struct page *)

> And why not VM_BUG_ON_PAGE/FOLIO()?

Will change to those

> > 
> > atomic_add(nr, &page->_refcount);
> >  if (page_ref_tracepoint_active(page_ref_mod))
> >  __page_ref_mod(page, nr);
> > 
> -- 
>  Kiryl Shutsemau / Kirill A. Shutemov
>


  reply	other threads:[~2026-06-04 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 10:13 [PATCH v3 0/2] mm: improve folio refcount scalability ilya.gladyshev
2026-06-04 10:15 ` [PATCH v3 1/2] mm: drop page refcount zero state semantics ilya.gladyshev
2026-06-04 11:04   ` Kiryl Shutsemau
2026-06-04 12:47     ` ilya.gladyshev [this message]
2026-06-04 10:15 ` [PATCH v3 2/2] mm: implement page refcount locking via dedicated bit ilya.gladyshev

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=431c8a974d685d547b0ba1ebe887ce200291e044@linux.dev \
    --to=ilya.gladyshev@linux.dev \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=artem.kuzin@huawei.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=foxido@foxido.dev \
    --cc=harry.yoo@oracle.com \
    --cc=ivgorbunov@me.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=pfalcato@suse.de \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=torvalds@linuxfoundation.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=yuzhao@google.com \
    --cc=ziy@nvidia.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