From: Matthew Wilcox <willy@infradead.org>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
sidhartha.kumar@oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm/migrate: Convert isolate_movable_page() to use folios
Date: Sun, 22 Jan 2023 12:46:34 +0000 [thread overview]
Message-ID: <Y80wKtc22eHApjEN@casper.infradead.org> (raw)
In-Reply-To: <20230121005622.57808-3-vishal.moola@gmail.com>
On Fri, Jan 20, 2023 at 04:56:21PM -0800, Vishal Moola (Oracle) wrote:
> int isolate_movable_page(struct page *page, isolate_mode_t mode)
> {
> + struct folio *folio = page_folio(page);
> const struct movable_operations *mops;
>
> /*
> @@ -71,11 +72,11 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode)
> * the put_page() at the end of this block will take care of
> * release this page, thus avoiding a nasty leakage.
> */
> - if (unlikely(!get_page_unless_zero(page)))
> + if (unlikely(!folio_try_get(folio)))
This changes behaviour. Previously when called on a tail page, the
call failed. Now it succeeds, getting a ref on something that at
least was the folio head at some point.
If you're going to do this, you need to recheck that the page is still
part of the folio after getting the ref (see gup.c for an example).
But I think we should probably maintain the behaviour of failing on
tail pages.
Maybe something like ...
if (unlikely(!get_page_unless_zero(page)))
goto out;
/* Refcount is zero on tail pages, so we must have a head */
folio = (struct folio *)page;
next prev parent reply other threads:[~2023-01-22 12:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-21 0:56 [PATCH 0/3] Convert a couple migrate functions " Vishal Moola (Oracle)
2023-01-21 0:56 ` [PATCH 1/3] mm: Add folio_movable_ops() Vishal Moola (Oracle)
2023-01-21 0:56 ` [PATCH 2/3] mm/migrate: Convert isolate_movable_page() to use folios Vishal Moola (Oracle)
2023-01-22 12:46 ` Matthew Wilcox [this message]
2023-01-23 15:48 ` Matthew Wilcox
2023-01-21 0:56 ` [PATCH 3/3] mm/migrate: Convert putback_movable_pages() " Vishal Moola (Oracle)
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=Y80wKtc22eHApjEN@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sidhartha.kumar@oracle.com \
--cc=vishal.moola@gmail.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