Message ID | 20240130014208.565554-3-hannes@cmpxchg.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-43741-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp942007dyb; Mon, 29 Jan 2024 17:43:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUQOfMCBmFfpyMWoVS1XCVEqOxutVDT0SSWtqh/1q+ws6EkK+LpuYp05LF1N+ppeYtV+5j X-Received: by 2002:a05:6358:4403:b0:175:9073:d6c with SMTP id z3-20020a056358440300b0017590730d6cmr8057193rwc.20.1706578994355; Mon, 29 Jan 2024 17:43:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706578994; cv=pass; d=google.com; s=arc-20160816; b=fyP5DUGwfR4vf0DoAApwDpiWLo1n4taxyDyNi+q8/MdQ5b/mXryI6CS0eGKlEa3s1s RY7oWiGsPDaMIBYvD+IJbcZp/CA7QB3FU+YIDbRoRpkthoT2OPGYDblIX5IgVGWLKzY0 rg3BR9G9B++HMEm20N7zLYq+akrLlm7l4c3CDs30GUa63jocx09S3wTI4UnFO3ovpcWn TBvIiXxcGTHepy3vZYTHFRYD45ZH4ZA/6N6rYbyICJZ7pj516x940fzJVfRZ6/IFdlcQ wlyDcxgcAW/fyLqSWRAtfICNVUuYGdiWvJyLVn4MAsvDm7CFozVcQ7mAKOaPlHTQ08pk upkA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XjDB9WMZenyNFfJ6FneP+eMAzd2uIdtYL+Q7hbWifG0=; fh=pEdtrChUTDmvuLILGSavwskaPZjBcM3e1cB9O4e7o4U=; b=u5zor0bYe36kpJVs/Xaxt/Re4S+Hz/0kGuTMQBOa0PdLNeTjO4LpkaAWX6R9XqDPxg xeTWAcw+zi++lvW1q/aIJi+9m0aPVztrpH7o3KRNzhwQNQzK6K+Ca/Hd2yH4moBT0qE5 DX5djGFFO+t6dgdgN2V15YgAOZi0mPykGLHzN2gZYzcdqgd5MzV7Go94PgsvXCX+XSBU bpR3O6anqHHxy9qkVkywW7r0fwKeyjkmQ6AOqgqdaxWxbwdXkjGAcydobzuh/rkJ8LCW ZROLLvxxBAdcVp/25RpWt6OijdoSJTGw1pi7IrSWAwYHX7QyN0w10td7pCHOQ51t53b4 6Xeg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=AHQnVhmf; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-43741-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43741-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id az16-20020a17090b029000b0028e8527b20bsi7400931pjb.154.2024.01.29.17.43.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 17:43:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43741-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=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=AHQnVhmf; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-43741-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43741-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.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 1FBEB28351D for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 01:43:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60C8A374C9; Tue, 30 Jan 2024 01:42:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="AHQnVhmf" Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69AF63611F for <linux-kernel@vger.kernel.org>; Tue, 30 Jan 2024 01:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706578939; cv=none; b=LSCL1VQFe9DzhQ33GvyJt//i8gLebVo739elpmm+42OEPmYAV2c8ACf4jl/NSNnvj5plHBolYXcCcMOZ19KtoiBeEhHanN3hifRxqRTp1RYeaGjvdZbbd/oB1kjiehV1mNTdC8gRxFYZvBKbc29SadOlanxhOgwbrEeZ3KzOTDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706578939; c=relaxed/simple; bh=noTUjFASFtVL4nlWHNtBmau/aPj35kRvuT1b3oVbdds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ticA+TNKMA4HOSB1dmjjnFbGBmBC+CjvpBVxYqRF+tBvcDSM0Q8ZHmsRMoAfhk/u1geYg9GkNoZF1LOqg9mxPIxMVf2QOLlbhVzP8GlXyI9OCvfcfH7++pJrN5HmgUOia2C1dPKjdwGIvrM468mjI9BpkQiRUZoY0kR//zR3G2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=AHQnVhmf; arc=none smtp.client-ip=209.85.222.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-78405c9a152so63648485a.1 for <linux-kernel@vger.kernel.org>; Mon, 29 Jan 2024 17:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1706578936; x=1707183736; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XjDB9WMZenyNFfJ6FneP+eMAzd2uIdtYL+Q7hbWifG0=; b=AHQnVhmfY/h2MSmZfnwrS6AYxkZk5EaAGvdfE38xjFK8XKBZlDE+qovV+t0qQzPL9s /vDe7m7wjXt709NpxVHlYnWfXQvvkfBct0TKRyRaDdYW7oMuFOgPUIdj+ZhlIoPW/7+h jMva+3EKv4QkIij+RymXA7615Y95jZiXt/ZW0UotZSLSa9uDWI7eRv+tgFzYwbiWmWEY kUwSvHqZW17L6kK43DwfUzdUmhb41hI4WCmqpp6RsZTqmB7eFoZ0grAnbm20sEszWqxA GsosJoiiBqZwQUe6e+L4t+XuQnJ0k0VS86IW0BTETz18/ZIKpr+vtn/nS0IIuU+JEz+B NtnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706578936; x=1707183736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XjDB9WMZenyNFfJ6FneP+eMAzd2uIdtYL+Q7hbWifG0=; b=masuGMnK3+F55a5AVXBLMF7R/lMUx/J4WlJsAIxrtTD9YVdtIaumzRNCF/gV1ZJkM1 Yp0Qrm6oQVfge9N6I0wxFc73JWCs1/K5SsHkIAAuByx9q24rXun02JNxAuvGXBGcAVDm v5kIdwMiXXyhkoddECAYu68Kn0Q9iBOgAxNZs55iRJW6iFqhjtR1ocB7uS3GgxHNTlyy CrXqnD755vG5dZ7XjyXDwv8tNFomGSHBqWH1KD40vafx/QBFvjekVodPIl5ftFyDw6GY /z1Ye/iCvMhHn/F+EZRaJClBY0czptKtDVRrj3w6wVHEGJepJUp3+oVxwLke4HPc/qDX nL7A== X-Gm-Message-State: AOJu0Yw76JVSBQdjd+GKSRRKAZX68Ymecf0yfnOspzwZolabwuakmmyF CmCQ03Vb/wWRr+tZ7fjuCirvSaoVu3JgKC2cGryim2KjmFEOlHxBx9clZPoJgPg= X-Received: by 2002:ad4:5c4d:0:b0:686:ac5b:fe7d with SMTP id a13-20020ad45c4d000000b00686ac5bfe7dmr9546558qva.125.1706578936382; Mon, 29 Jan 2024 17:42:16 -0800 (PST) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id u12-20020a0cea4c000000b0068c43ac393asm2518373qvp.146.2024.01.29.17.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 17:42:16 -0800 (PST) From: Johannes Weiner <hannes@cmpxchg.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: Nhat Pham <nphamcs@gmail.com>, Yosry Ahmed <yosryahmed@google.com>, Chengming Zhou <zhouchengming@bytedance.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/20] mm: zswap: inline and remove zswap_entry_find_get() Date: Mon, 29 Jan 2024 20:36:38 -0500 Message-ID: <20240130014208.565554-3-hannes@cmpxchg.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130014208.565554-1-hannes@cmpxchg.org> References: <20240130014208.565554-1-hannes@cmpxchg.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789477775677196511 X-GMAIL-MSGID: 1789477775677196511 |
Series |
mm: zswap: cleanups
|
|
Commit Message
Johannes Weiner
Jan. 30, 2024, 1:36 a.m. UTC
There is only one caller and the function is trivial. Inline it.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
mm/zswap.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
Comments
On 2024/1/30 09:36, Johannes Weiner wrote: > There is only one caller and the function is trivial. Inline it. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com> > --- > mm/zswap.c | 17 ++--------------- > 1 file changed, 2 insertions(+), 15 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 173f2e6657de..cf864aaa214d 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -559,19 +559,6 @@ static void zswap_entry_put(struct zswap_entry *entry) > } > } > > -/* caller must hold the tree lock */ > -static struct zswap_entry *zswap_entry_find_get(struct rb_root *root, > - pgoff_t offset) > -{ > - struct zswap_entry *entry; > - > - entry = zswap_rb_search(root, offset); > - if (entry) > - zswap_entry_get(entry); > - > - return entry; > -} > - > /********************************* > * shrinker functions > **********************************/ > @@ -1708,13 +1695,13 @@ bool zswap_load(struct folio *folio) > > VM_WARN_ON_ONCE(!folio_test_locked(folio)); > > - /* find */ > spin_lock(&tree->lock); > - entry = zswap_entry_find_get(&tree->rbroot, offset); > + entry = zswap_rb_search(&tree->rbroot, offset); > if (!entry) { > spin_unlock(&tree->lock); > return false; > } > + zswap_entry_get(entry); > spin_unlock(&tree->lock); > > if (entry->length)
On Mon, Jan 29, 2024 at 08:36:38PM -0500, Johannes Weiner wrote: > There is only one caller and the function is trivial. Inline it. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Yosry Ahmed <yosryahmed@google.com>
On Mon, Jan 29, 2024 at 5:42 PM Johannes Weiner <hannes@cmpxchg.org> wrote: > > There is only one caller and the function is trivial. Inline it. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> > --- > mm/zswap.c | 17 ++--------------- > 1 file changed, 2 insertions(+), 15 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 173f2e6657de..cf864aaa214d 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -559,19 +559,6 @@ static void zswap_entry_put(struct zswap_entry *entry) > } > } > > -/* caller must hold the tree lock */ > -static struct zswap_entry *zswap_entry_find_get(struct rb_root *root, > - pgoff_t offset) > -{ > - struct zswap_entry *entry; > - > - entry = zswap_rb_search(root, offset); > - if (entry) > - zswap_entry_get(entry); > - > - return entry; > -} > - > /********************************* > * shrinker functions > **********************************/ > @@ -1708,13 +1695,13 @@ bool zswap_load(struct folio *folio) > > VM_WARN_ON_ONCE(!folio_test_locked(folio)); > > - /* find */ > spin_lock(&tree->lock); > - entry = zswap_entry_find_get(&tree->rbroot, offset); > + entry = zswap_rb_search(&tree->rbroot, offset); > if (!entry) { > spin_unlock(&tree->lock); > return false; > } > + zswap_entry_get(entry); Neat. Reviewed-by: Nhat Pham <nphamcs@gmail.com> > spin_unlock(&tree->lock); > > if (entry->length) > -- > 2.43.0 >
diff --git a/mm/zswap.c b/mm/zswap.c index 173f2e6657de..cf864aaa214d 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -559,19 +559,6 @@ static void zswap_entry_put(struct zswap_entry *entry) } } -/* caller must hold the tree lock */ -static struct zswap_entry *zswap_entry_find_get(struct rb_root *root, - pgoff_t offset) -{ - struct zswap_entry *entry; - - entry = zswap_rb_search(root, offset); - if (entry) - zswap_entry_get(entry); - - return entry; -} - /********************************* * shrinker functions **********************************/ @@ -1708,13 +1695,13 @@ bool zswap_load(struct folio *folio) VM_WARN_ON_ONCE(!folio_test_locked(folio)); - /* find */ spin_lock(&tree->lock); - entry = zswap_entry_find_get(&tree->rbroot, offset); + entry = zswap_rb_search(&tree->rbroot, offset); if (!entry) { spin_unlock(&tree->lock); return false; } + zswap_entry_get(entry); spin_unlock(&tree->lock); if (entry->length)