linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/zsmalloc: move get_zspage_lockless into #ifdef
@ 2024-02-28  9:40 Arnd Bergmann
  2024-02-28  9:45 ` Chengming Zhou
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-02-28  9:40 UTC (permalink / raw)
  To: Minchan Kim, Sergey Senozhatsky, Andrew Morton, Chengming Zhou
  Cc: Arnd Bergmann, Nhat Pham, Domenico Cerasuolo, linux-mm, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

It's only used from inside of an #ifdef section, causing a warning otherwise:

mm/zsmalloc.c:735:23: error: unused function 'get_zspage_lockless' [-Werror,-Wunused-function]
  735 | static struct zspage *get_zspage_lockless(struct page *page)
      |                       ^~~~~~~~~~~~~~~~~~~

Move it down into that block to avoid adding another #ifdef.

Fixes: 2258bdebb55e ("mm/zsmalloc: don't hold locks of all pages when free_zspage()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 mm/zsmalloc.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 1a044690b389..11422305d819 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -731,14 +731,6 @@ static struct zspage *get_zspage(struct page *page)
 	return zspage;
 }
 
-/* Only used in zs_page_migrate() to get zspage locklessly. */
-static struct zspage *get_zspage_lockless(struct page *page)
-{
-	struct zspage __rcu **private = (struct zspage __rcu **)&page->private;
-
-	return rcu_dereference(*private);
-}
-
 static struct page *get_next_page(struct page *page)
 {
 	struct zspage *zspage = get_zspage(page);
@@ -1651,6 +1643,13 @@ static void migrate_write_unlock(struct zspage *zspage)
 }
 
 #ifdef CONFIG_COMPACTION
+/* Only used in zs_page_migrate() to get zspage locklessly. */
+static struct zspage *get_zspage_lockless(struct page *page)
+{
+	struct zspage __rcu **private = (struct zspage __rcu **)&page->private;
+
+	return rcu_dereference(*private);
+}
 
 static const struct movable_operations zsmalloc_mops;
 
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-28  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-28  9:40 [PATCH] mm/zsmalloc: move get_zspage_lockless into #ifdef Arnd Bergmann
2024-02-28  9:45 ` Chengming Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).