From patchwork Tue Jan 30 01:36:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13536668 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 55D6EC47DA9 for ; Tue, 30 Jan 2024 01:42:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62AC56B00AA; Mon, 29 Jan 2024 20:42:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4ED4D6B00AB; Mon, 29 Jan 2024 20:42:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 340566B00AC; Mon, 29 Jan 2024 20:42:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1D0AF6B00AA for ; Mon, 29 Jan 2024 20:42:19 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F347F40293 for ; Tue, 30 Jan 2024 01:42:18 +0000 (UTC) X-FDA: 81734277156.01.D1ED6F5 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf01.hostedemail.com (Postfix) with ESMTP id 655AC4000B for ; Tue, 30 Jan 2024 01:42:17 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=QdYTEIOZ; spf=pass (imf01.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.41 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706578937; 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:in-reply-to:references:references:dkim-signature; bh=XjDB9WMZenyNFfJ6FneP+eMAzd2uIdtYL+Q7hbWifG0=; b=u9aFt8AwRq9k6QSBT5EcV037cmf+Y0rYzIjaWuyLIdDDmxZ/Q4K7PKYY4JdydmFY2z8zvY 3UhJyr+xfFv6uAA/I7sqI2HEb6o+O7AMk4cr+WllX+k7s+EHsQgEa3GJB3IvbIBgZblxlt ZMbs+yOY7CS5P/VgIoQ9Stp3kpgCG2Q= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=QdYTEIOZ; spf=pass (imf01.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.41 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706578937; a=rsa-sha256; cv=none; b=lyHj48BQyJhbhLcKm7ZDjpKruWxS+GrPToUK47HGlcxqRyFtKKgEh6Ht/8TskXndZTskIH YmztASX1/0Rchkrc71MZ05eaWgN3Lt1sX9iWj3nlmf/LyFcj100E6xQax/U4EmT2eOznvK uzqF7ZZ+YTAebmgq1tcgQUYvohGImS8= Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-68009cb4669so26878136d6.1 for ; Mon, 29 Jan 2024 17:42:16 -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=kvack.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=QdYTEIOZMAd/OeaWKwCz8uFVXs16m875ZLAL/ENdFRBQLNevcJQIwmP/XHLg6/N3Gb 5M19MGkS1pTYatn3LssKctSEVS2iQYQfJxfNDPHCE+4WKYq2rt5h+VYLGk/W6TZfH374 Yr/tz5MDMlH1MwOuX7n6ARAxp7pGKwAKpClGMq/DcCu/fk7/UXFmkZIgZMIJdq5S08qu CNycy0BsROYdaHrJr6wK0avoj9nGT/R4Vym6w7AyHOPhwa56DfdZbVOXHb5Ne5SKNaxx VeViZNRft0qNf8GXA9Lh48eTlhUVPd3q7o+N649P0Cay1H1aAPt0AtjMpZx/yfce7bfR lNzA== 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=K0SSpH+IEN6iWPdAWrqpzKlHGYXFh2WnfjRBQWswCL6qQodH7bBE7ikN4k2E8rkaqR uP+2V6RPoBHFiCrs+Qdk767dvZ/xxZlUQ9G63anm9Z9D0JWKzY7HsjuS4rafjU/nzeJj XdQ2tDjk9fs5ITjqVt2clcqzfyLjg3KdQuSG4VrvbfFNqTpWAwZICzwI0SFuvBn1M58x RPTldqz82t4j5621BU/yam+raj3AVUthXyDjwsrVRYj5e543WuzsaqIJny2+MB4OgvJ3 +f9QkFv3QezU1fD/xte8ahEU6ujIXK5t4Sjia/s0oZjcRtSK4kAVIM/MhSYDhKKN+TuH o2HQ== X-Gm-Message-State: AOJu0Yw7OTwkM4ROtg/lvc1Tt7OZ6aJbtiRH2sPGfnpSpIx3GlGCW2w5 26tA8Yf2+NXUddhcIuLEDUfoTOPLTrgomFRrMa6qKde8HFNeT5adevzuyZxagNc= X-Google-Smtp-Source: AGHT+IHh4RV/gyq1SbWHKSfxOL3yFJXOcLXUJDddqpgCqc+YTjcqv3Unc9iTscwNHWga7GShhVQD0g== 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 To: Andrew Morton Cc: Nhat Pham , Yosry Ahmed , Chengming Zhou , 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> MIME-Version: 1.0 X-Rspamd-Queue-Id: 655AC4000B X-Rspam-User: X-Stat-Signature: qy5mn1dnjryyjdqn9hext9a7kdasrbsa X-Rspamd-Server: rspam01 X-HE-Tag: 1706578937-574401 X-HE-Meta: U2FsdGVkX19QqWXPMMB5WSRN4RdJAX+OHuIuP9nz6KvUFhFjW0euC6L6DIokTgxE64ni7S+HbGgUQN5UhuSdV0n4hxXtEvtJWEsHhjMdD3F198cfN3XJRBbdBKfW5NAePG4qk46PDMxDfJKP2fI9PkJ2TQ0P7diBk/OZjyb3DNlazpsisOnfN+jg/0flAaOiQUNTsi4AB671G6wPt6U4POpo6VUBvvWdqJzYRFaPvq7RrTZBRSQZePHRL3lIvj37gh3CduiOBDxXaE01BRyfHGPpW5Y8pQENZHPeee24pxOaHo1rc/D4Amv0JTIyOb14dz0gSeu7XQ8OeTGnp44QEriBmN2Wk0H/4nx5S/IcTRR2SRXAPVMZ+Nnf71Dk1uoc9wfiIUsMGLGYl57lvLaJbImWhC2zn7u85FcfSn4p/FXnE1xsSFI2nYfQz+daZSVUyd+VXW1fXIeC4UOYtLjFsWBz1y4OfLy5O2oMIh750psfGs40/xjw/DTn+Fdbf/nxl8jEgC6R19JIbe/znowLJ+nkswkMn27aeuL00KiCPKqh1d8yrkajvRFH8vRXhcNldXXYS3YaqdAs3QhUQrHEEOu9mIKEW7WNpD2mrmsXTVQFx+7xxEaOmq6TRcpNggbciFGXMw3zThsPPpfxD3e9V5LWcjN7SZvi2hb0XK9DRm+yitKh0LvsiChhsqBVBU1hRc3gYriEYwaltI84PVzfN7Q7TOCyj+cQ+kQvqsqwtRxNaXszV6vIJF5MrgoXVBFfaLAMBfMSZrjY3o8+hYQaoKoToqt7xZEH+c2ELhWvwdHOopC8eXvs8zmmiVHCq2HsS9Q5eZWZngrskxC8spImncPhctCqV+YAyV3UWhbTvoFP5lk/AHD73fNwlRjD0d3s3d0WjmYibu/8EM4prrOoL1Qkqkh86zXIVOOK8JIglCUxO9FZMXg+Eb3tYDPpxwmUUHs/6EUc9+1UjD2R2IC 5lzNDScR 9KlNFQQfCITfpeHksAqrzHedLYRkjvr6789OrrynVZy06WBAjJwqU3rbrAiujvyRWz3wnELlBsG2rPpoicdqNIk536ufU/fafuyp35KXtcJlfn7T4qC0YQYNkqe6h43xO3kzVIABGoczxcVYgU2lQVaL4II36wRYzJ7I0zInEl/z0OmPm7065bHr4Q/g1a936IB5p5By1GfigEnDFDoh9Dmh21BBk7LaJqpsP 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: There is only one caller and the function is trivial. Inline it. Signed-off-by: Johannes Weiner Reviewed-by: Chengming Zhou Acked-by: Yosry Ahmed Reviewed-by: Nhat Pham --- 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)