From: Vitaly Wool <vitaly.wool@konsulko.se>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
Vitaly Wool <vitaly.wool@konsulko.se>,
Igor Belousov <igor.b@beldev.am>
Subject: [PATCH] mm/zswap: export zswap API to modules
Date: Fri, 20 Jun 2025 21:35:52 +0200 [thread overview]
Message-ID: <20250620193552.2772125-1-vitaly.wool@konsulko.se> (raw)
There is no reason to not let modules use zswap capabilies to
densely store unused pages in RAM. This will allow to remove some
homebrew solutions for e.g. GPU drivers in favor of plainly using
zswap pool.
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.se>
Signed-off-by: Igor Belousov <igor.b@beldev.am>
---
mm/zswap.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/zswap.c b/mm/zswap.c
index 3c0fd8a13718..718d341f7482 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -502,6 +502,7 @@ unsigned long zswap_total_pages(void)
return total;
}
+EXPORT_SYMBOL(zswap_total_pages);
static bool zswap_check_limits(void)
{
@@ -756,6 +757,7 @@ void zswap_folio_swapin(struct folio *folio)
atomic_long_inc(&lruvec->zswap_lruvec_state.nr_disk_swapins);
}
}
+EXPORT_SYMBOL(zswap_folio_swapin);
/*
* This function should be called when a memcg is being offlined.
@@ -1638,6 +1640,7 @@ bool zswap_store(struct folio *folio)
return ret;
}
+EXPORT_SYMBOL(zswap_store);
/**
* zswap_load() - load a folio from zswap
@@ -1718,6 +1721,7 @@ int zswap_load(struct folio *folio)
folio_unlock(folio);
return 0;
}
+EXPORT_SYMBOL(zswap_load);
void zswap_invalidate(swp_entry_t swp)
{
@@ -1752,6 +1756,7 @@ int zswap_swapon(int type, unsigned long nr_pages)
zswap_trees[type] = trees;
return 0;
}
+EXPORT_SYMBOL(zswap_swapon);
void zswap_swapoff(int type)
{
@@ -1769,6 +1774,7 @@ void zswap_swapoff(int type)
nr_zswap_trees[type] = 0;
zswap_trees[type] = NULL;
}
+EXPORT_SYMBOL(zswap_swapoff);
/*********************************
* debugfs functions
--
2.39.2
next reply other threads:[~2025-06-20 19:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 19:35 Vitaly Wool [this message]
2025-06-20 19:47 ` Matthew Wilcox
2025-06-23 10:10 ` Vitaly Wool
2025-06-23 19:33 ` David Hildenbrand
2025-06-23 5:11 ` Christoph Hellwig
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=20250620193552.2772125-1-vitaly.wool@konsulko.se \
--to=vitaly.wool@konsulko.se \
--cc=akpm@linux-foundation.org \
--cc=igor.b@beldev.am \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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