linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Boris Burkov <boris@bur.io>, linux-mm@kvack.org, linmiaohe@huawei.com
Subject: Re: [PATCH RFC] mm: fix refcount check in mapping_evict_folio
Date: Wed, 14 Aug 2024 04:15:25 +0100	[thread overview]
Message-ID: <ZrwhTXKzgDnCK76Z@casper.infradead.org> (raw)
In-Reply-To: <5qxfn7y43mf6vkkk6adfgenilahe5uykscz7muxq7tjmjijxg3@dpshd4mrcxgn>

On Tue, Aug 13, 2024 at 12:58:09PM -0700, Shakeel Butt wrote:
> > +	/*
> > +	 * The refcount will be elevated if any page in the folio is mapped.
> > +	 *
> > +	 * The refcounts break down as follows:
> > +	 * 1 per mapped page
> > +	 * 1 from folio_attach_private, if private is set
> > +	 * 1 from allocating the page in the first place
> > +	 * 1 from the caller
> > +	 */
> 
> I think the above explanation is correct at least from my code
> inspection. Most of the callers are related to memory failure. I would
> reword the "1 per mapped page" to "1 per page in page cache" or
> something as mapped here might mean mapped in page tables.

It's not though.  The "1 from allocating the page in the first place"
is donated to the page cache.  It's late here and I don't have the
ability to work through what's really going on here.


  reply	other threads:[~2024-08-14  3:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 18:25 Boris Burkov
2024-08-13 19:58 ` Shakeel Butt
2024-08-14  3:15   ` Matthew Wilcox [this message]
2024-08-14  3:27     ` Boris Burkov
2024-08-14  3:46       ` Matthew Wilcox
2024-08-14  4:23         ` Boris Burkov
2024-08-20  8:00 ` David Hildenbrand
2024-08-20 14:00   ` David Hildenbrand

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=ZrwhTXKzgDnCK76Z@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=boris@bur.io \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=shakeel.butt@linux.dev \
    /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