From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, willy@infradead.org,
linux-kernel@vger.kernel.org,
"Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Subject: [PATCH mm-unstable v2 1/4] mm: Add folio_get_nontail_page()
Date: Mon, 30 Jan 2023 13:43:49 -0800 [thread overview]
Message-ID: <20230130214352.40538-2-vishal.moola@gmail.com> (raw)
In-Reply-To: <20230130214352.40538-1-vishal.moola@gmail.com>
folio_get_nontail_page() returns the folio associated with a head
page. This is necessary for folio conversions where the behavior of that
function differs between head pages and tail pages.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
include/linux/mm.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index dd295c020e85..5da260346406 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -879,6 +879,13 @@ static inline bool get_page_unless_zero(struct page *page)
return page_ref_add_unless(page, 1, 0);
}
+static inline struct folio *folio_get_nontail_page(struct page *page)
+{
+ if (unlikely(!get_page_unless_zero(page)))
+ return NULL;
+ return (struct folio *)page;
+}
+
extern int page_is_ram(unsigned long pfn);
enum {
--
2.38.1
next prev parent reply other threads:[~2023-01-30 21:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 21:43 [PATCH mm-unstable v2 0/4] Convert a couple migrate functions to use folios Vishal Moola (Oracle)
2023-01-30 21:43 ` Vishal Moola (Oracle) [this message]
2023-01-30 21:43 ` [PATCH mm-unstable v2 2/4] mm/migrate: Add folio_movable_ops() Vishal Moola (Oracle)
2023-01-30 21:43 ` [PATCH mm-unstable v2 3/4] mm/migrate: Convert isolate_movable_page() to use folios Vishal Moola (Oracle)
2023-01-30 21:43 ` [PATCH mm-unstable v2 4/4] 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=20230130214352.40538-2-vishal.moola@gmail.com \
--to=vishal.moola@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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