From: Mauricio Faria de Oliveira <mfo@igalia.com>
To: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>,
Oscar Salvador <osalvador@suse.de>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-dev@igalia.com
Subject: [PATCH RFC 9/9] mm: call page_owner swap hooks from generic swap hooks
Date: Fri, 5 Dec 2025 20:17:21 -0300 [thread overview]
Message-ID: <20251205231721.104505-10-mfo@igalia.com> (raw)
In-Reply-To: <20251205231721.104505-1-mfo@igalia.com>
Finally, call the page_owner swap hooks from the generic swap hooks.
This plugs the new functionality into the kernel.
Add a missing include in 'page_owner.h' to fix build errors in files
that include 'pgtable.h' (thus now 'page_owner.h') without an earlier
include that provides 'pg_data_t':
In file included from .../include/linux/pgtable.h:19,
from .../arch/x86/boot/startup/map_kernel.c:7:
.../include/linux/page_owner.h:20:41: error: unknown type name ‘pg_data_t’
Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
---
include/linux/page_owner.h | 1 +
include/linux/pgtable.h | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h
index cd95aacceba7..d7029d1e41de 100644
--- a/include/linux/page_owner.h
+++ b/include/linux/page_owner.h
@@ -3,6 +3,7 @@
#define __LINUX_PAGE_OWNER_H
#include <linux/jump_label.h>
+#include <linux/mmzone.h>
#ifdef CONFIG_PAGE_OWNER
extern struct static_key_false page_owner_inited;
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 23d30afe439e..ae397f5884d5 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -16,6 +16,7 @@
#include <linux/errno.h>
#include <asm-generic/pgtable_uffd.h>
#include <linux/page_table_check.h>
+#include <linux/page_owner.h>
#if 5 - defined(__PAGETABLE_P4D_FOLDED) - defined(__PAGETABLE_PUD_FOLDED) - \
defined(__PAGETABLE_PMD_FOLDED) != CONFIG_PGTABLE_LEVELS
@@ -1222,22 +1223,31 @@ static inline void arch_swap_restore(swp_entry_t entry, struct folio *folio)
static inline int hook_prepare_to_swap(struct folio *folio)
{
- return arch_prepare_to_swap(folio);
+ int ret;
+
+ ret = arch_prepare_to_swap(folio);
+ if (ret)
+ return ret;
+
+ return page_owner_prepare_to_swap(folio);
}
static inline void hook_swap_invalidate_page(int type, pgoff_t offset)
{
arch_swap_invalidate_page(type, offset);
+ page_owner_swap_invalidate_page(type, offset);
}
static inline void hook_swap_invalidate_area(int type)
{
arch_swap_invalidate_area(type);
+ page_owner_swap_invalidate_area(type);
}
static inline void hook_swap_restore(swp_entry_t entry, struct folio *folio)
{
arch_swap_restore(entry, folio);
+ page_owner_swap_restore(entry, folio);
}
#ifndef __HAVE_ARCH_MOVE_PTE
--
2.51.0
prev parent reply other threads:[~2025-12-05 23:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 23:17 [PATCH RFC 0/9] mm/page_owner: add support for pages in swap space Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 1/9] mm: add config option SWAP_PAGE_OWNER Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 2/9] mm/page_owner: add parameter option 'page_owner=on,swap' Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 3/9] mm/page_owner: add 'struct swap_page_owner' and helpers Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 4/9] mm/page_owner: add 'xarray swap_page_owners' " Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 5/9] mm/page_owner: add swap hooks Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 6/9] mm/page_owner: report '(swapped)' pages in debugfs file 'page_owner' Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 7/9] mm/page_owner: add debugfs file 'swap_page_owner' Mauricio Faria de Oliveira
2025-12-05 23:17 ` [PATCH RFC 8/9] mm: call arch-specific swap hooks from generic swap hooks Mauricio Faria de Oliveira
2025-12-05 23:17 ` Mauricio Faria de Oliveira [this message]
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=20251205231721.104505-10-mfo@igalia.com \
--to=mfo@igalia.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=vbabka@suse.cz \
/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