From patchwork Wed Feb 28 09:40:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13575145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 854EEC47DD9 for ; Wed, 28 Feb 2024 09:40:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07DA46B009C; Wed, 28 Feb 2024 04:40:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0364F6B00A5; Wed, 28 Feb 2024 04:40:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE82A6B00A6; Wed, 28 Feb 2024 04:40:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CBA536B009C for ; Wed, 28 Feb 2024 04:40:47 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 95802140EC3 for ; Wed, 28 Feb 2024 09:40:47 +0000 (UTC) X-FDA: 81840718134.03.F86D298 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf07.hostedemail.com (Postfix) with ESMTP id AC9294000F for ; Wed, 28 Feb 2024 09:40:45 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=M89tswzd; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of arnd@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709113246; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Nf202lJoRWN6o1Z/oehgQE2q0xI7gvW3sKmUDPYuALw=; b=1hJSQ7PDA1VK0rDVtoPtlevMBtlI3YgyizTrw0xLxztgF71aiqaKMOOUCYcfo7QGBuTgzL /c+vH77Gyeb81TY1QLRmH9PE8K4uhfWAjZH/6VHIdNfyKYZJqqcSfjHCE5I+IxjGbFuK+m cgBL5fWdiQlb83GVSW5kfNv2j5UpFQQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=M89tswzd; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf07.hostedemail.com: domain of arnd@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709113246; a=rsa-sha256; cv=none; b=7jROSRzfCKexLVMBOXhsnWPdyAe45zuDTNtRatzrQtvjyvCB7WQ58ma6vRfCtq5KNNEziX 0h++u9e7mvTJycqqZ8bPxq3Ymt/z4nja1W0ctBDfFFCpUi1pyMnFQJosd/8mhNyJzH7WxY zc2EClUdpIuh1HKi90gcrIkF8v3729g= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 2ED97CE204B; Wed, 28 Feb 2024 09:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63376C433F1; Wed, 28 Feb 2024 09:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709113241; bh=lvoTs/0UXElm44f/AN9pIyL/qzddZIntAlgjTtgGHwc=; h=From:To:Cc:Subject:Date:From; b=M89tswzdasInlvO4kCicJK0gvJxK5iNT5k2Pzi5h1eJa6leEUEkKjhGDDg8wuX0hq 4yuhv7ypmp6YVKnk1yarUuspZBWhdxtLRs5TcpxgznyTKCwdNJiwp/7C0sgcvAlIKn 3zUY87S59TPo8j1pfIycdz140Hf99KJJj68f79Ko9lSo1lwhI/kxNdKZ++FMVwmtV4 FNynQe2hL4T1n7qOzhoEqB51U9JY5gmftA7YdC4sM8GOgsRVCjnb5inVq9HjT85MMo kw+grGrhicACNWXBYv9emNyTn9vt5C5T4zLepkUcHHYCjjTemcp4Zbx1pkMoKm5WhV FlqPCpg1RqfXQ== From: Arnd Bergmann To: Minchan Kim , Sergey Senozhatsky , Andrew Morton , Chengming Zhou Cc: Arnd Bergmann , Nhat Pham , Domenico Cerasuolo , 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 Message-Id: <20240228094036.2267912-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: AC9294000F X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: chk5xnzzcmza6rr9zu4abckrxnrd1oft X-HE-Tag: 1709113245-191768 X-HE-Meta: U2FsdGVkX1+QgWDovvc5uv58hVDjDmsbrOYsZ+piJkjp4tV6ANYkAsPtAkpaAQAYNArxEnVvTqZf4Qf/dX7DLEHZus2BdjrGmF5sG9NaV3nW3kMTB/EClNwhH2xNgx7+xdKGknpdfyPBpfFGoi9vh8GnrTOW9YtGF/8s73FSDf0q0VU1Z9TJlazyUij4aceWyFCmhaP9i1L9Z+AWJPUsLxKlsmfHd6L57wl3i1aR0qo6YY3bEYi/x/jjfdMYmYivnAL1d/1q3uwBUF5ai9OWaqToM6PUleOXzP1pnqqVx8HBefb2RM8ZPmM6BM8LFNM2cM/4ef7SdW1zNsBbsNmx+WXbb+bpFTHyIktDcJoK91dwbqenfe5YxHZE+h+BPXWlDy5vrUpfX4pnJV9Sm7Eqn9i0YZ6Kgwtp0TftQCy/5MJMl5WjqEYUeTCDlIZfriGkRe0T2qPJGKmi5QZPAydET97oclg9Ryc+tLQlRlW6Xqvn6sBMeW4wfJL8SDXEgnLQc475kVwXJKQMi7WtS1hk2fjhifoccBCvD0LMThi+2Xg1lZubEGxISVh0v6NKGT64Ijmq81Z2GKvT2OJRajZfdraJ9gmEOJxQ3yOvjOZEFK+mI1zmbU7uAJcL5tkKSQqdPnBBm11xODaVglqwZvDR5WQevW0cGuVQY+jVVj69uvJh3G3Rr5uOPr6xR4jbM7xBR9dFGLbp8rOnDM+FlSSIlqZ+CBNPte22gNV4Bs8+NE6tnKw7rrkwA1wSE5zGLtcHT8s9B32c7bM50IUU4OgRmg1p5MZ4FDAes49g8Ru6N3satX/93kPKC/UizQs0nfwSA3GiYYo57tOKPr48J7UtZt6TlQDvdA3G2bRNgeKPDLzWVwbqAbipJ5QZvpeW96mmdESf6NflKHQ09YWgNq9UUe9KQfxAnz+X75vebctrBfoah37/oTXxSJAWZ63cNH3nBCTsCyHb1Mb84umM3FF FyVhp3vz N9yGZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Arnd Bergmann 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 --- 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;