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: 207736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3237188dyb; Wed, 28 Feb 2024 01:41:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVMXGEr83+T5Op+OvPWY0XPruYZqHqOOjedtttqla1fyTnXjXdevVNaCa8LWf8STLU6WOgoNzLuLq34tvCJ02KRYMnT4w== X-Google-Smtp-Source: AGHT+IHzGRiLokPlmrmqFsEJA927A2btmALIr0k5zApHamXbe734BRzx8BDbGTnAGcaAlaB2C7/R X-Received: by 2002:a05:6e02:1194:b0:365:2732:8bb6 with SMTP id y20-20020a056e02119400b0036527328bb6mr12709067ili.11.1709113284138; Wed, 28 Feb 2024 01:41:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709113284; cv=pass; d=google.com; s=arc-20160816; b=Fh7yZRyboRs3GSZcuNALQ7+wfjHQl4yUDJTuLGvLT6yWopTvAHkr1xr3GVzJG2JK5b nFIEgpf4245wps3IkG/XNektkJUlxAy2q+0mYrs8JtJVpDtl0nDky8b9uobSqkRyZy14 tQMo1Zsk4WmxqLL3e2g4sv+7JAknjGVmXDgVxqrdi4yFIgqXcWTtj+Q+PHOnT1MxUsFg SaSuyFNAcgcG9TCa3Aj1giEb1+1BmxBRagVMfML/8tk6hA0SKHZIUhpqmYWs1+mAVdMs SWE2JYSL5PBRAsqoWnIpKfzNM95eLXAxHpXnPax/anLc/D8wto9qKQZayRiuNZZcU3V5 wS0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Nf202lJoRWN6o1Z/oehgQE2q0xI7gvW3sKmUDPYuALw=; fh=5BvqvVi/8m7lS1yGIg8wlNlFY4OXF6ZlqXcKemj1x+0=; b=ITZSGyRIhoQMYycIZwzWE9a+dbl86nKmfgq6e/UWR0vEA2g5aCEiVEwhlCAbMRitw9 gVq2swX2yoD3vFyrYQjthbJIBD3BaLyJ6Q2uQNhF2swWDM/wyQiUtn5dZf9t3xeoOebk HvkYoLmt8e0QAaGHhYb2crqq5gzcWWlMkL4TXLL6HJZgTDseTTt1nJxUJPmCnu7IYl6M mUq0JabLhdyliizxE94XYtiDGPE45L3YMD6vZQ4ccjxMwsDt9LkiFTJzReiQ+PXAKT4m rBnPnMG7lLFXG4CrO7dQk50qzH/7rnNYjnzFnMKjlSIxWOb4LbKIUe/K4zt5pt6qowvq Pz/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M89tswzd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-84784-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84784-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x6-20020aa79a46000000b006e56589dfc2si741401pfj.133.2024.02.28.01.41.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 01:41:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84784-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M89tswzd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-84784-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84784-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 89F83289739 for ; Wed, 28 Feb 2024 09:40:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B60E364CD; Wed, 28 Feb 2024 09:40:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M89tswzd" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECF9436103 for ; Wed, 28 Feb 2024 09:40:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709113242; cv=none; b=rC1XlYisAMkEZngBWT66A5JVi9z9VVh30LaPF34l7YDYTwdPCt5Zj0hmzF8I+TlfcuiLOiOpTl2QzflVE8y3/O3oCpERgWjZbg29yKvE/SnHzGT4jPqIyB8d4L1ftIWQRvjvn9zBb7P63qgwmqnlMv2h75CrTT8Ti3W/kfj+6XE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709113242; c=relaxed/simple; bh=lvoTs/0UXElm44f/AN9pIyL/qzddZIntAlgjTtgGHwc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=uSGYPvRG261l1KOS/RZEn52Io0AD7qi5WsUhhlpkm0ycHtP/vieF7dWLIYDPffFAAQnwW5aDYg0su1wkFUn74D6Ew18PVTfYVWdaum58pMYUUdaKE3++fXLJ4FLASWURBf/3FPb4RN8xM7yDNL6YyJX79qiqWpoLBDeCDD/ldiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M89tswzd; arc=none smtp.client-ip=10.30.226.201 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792135171502692111 X-GMAIL-MSGID: 1792135171502692111 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;