linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Chengming Zhou <zhouchengming@bytedance.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Nhat Pham <nphamcs@gmail.com>,
	Domenico Cerasuolo <cerasuolodomenico@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm/zsmalloc: move get_zspage_lockless into #ifdef
Date: Wed, 28 Feb 2024 10:40:31 +0100	[thread overview]
Message-ID: <20240228094036.2267912-1-arnd@kernel.org> (raw)

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



             reply	other threads:[~2024-02-28  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28  9:40 Arnd Bergmann [this message]
2024-02-28  9:45 ` [PATCH] mm/zsmalloc: move get_zspage_lockless into #ifdef Chengming Zhou

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=20240228094036.2267912-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=cerasuolodomenico@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=zhouchengming@bytedance.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;
as well as URLs for NNTP newsgroup(s).