From patchwork Tue Jan 30 01:36:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13536682 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 604E3C47DA9 for ; Tue, 30 Jan 2024 01:42:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 711ED6B00B9; Mon, 29 Jan 2024 20:42:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6206B00BC; Mon, 29 Jan 2024 20:42:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 381C06B00B9; Mon, 29 Jan 2024 20:42:36 -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 2191D6B00B9 for ; Mon, 29 Jan 2024 20:42:36 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E98E580738 for ; Tue, 30 Jan 2024 01:42:35 +0000 (UTC) X-FDA: 81734277870.01.91FA754 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by imf28.hostedemail.com (Postfix) with ESMTP id 3A676C000A for ; Tue, 30 Jan 2024 01:42:34 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=ZUX1zZBM; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.178 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706578954; 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=zBr/4NzQcxrA4rNO53TUlaG7d5zRLMT2JlV2BMAMPQs=; b=h7Ufz9WCrfiv9YYPAqejoqw9ACvcrzReSSkSyLUnRBJzPlD8vWRQ3KZwevOueKcCvSSECQ HbxoT0SKN1LRHk8zTIMGXBEZ2sBSRkipOOD+hAIWFJZNgnDy9HIcfRBPiuVFa0OxLzIq5f U7YAJQ74O2VE4gzD9jCg9oLBSRKqHic= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=ZUX1zZBM; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf28.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.178 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706578954; a=rsa-sha256; cv=none; b=7Hl5AoBFqZG1GmeNYEt7LwmqYNFNz0ef20trZ2oI1lykz6gpIKeyWr3AZkrR4ZkXsGj2Oe Wv5/jT++fbQbp32rOUpzRCwPU/aKGQkMIhfDOO6n4Ps4CbwV0EPjbSvBDpo7XytAVd5g8Y /E8aPv91H5rClqNOZbzaUAwLmz0PH38= Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-42a9f4935a6so12530651cf.1 for ; Mon, 29 Jan 2024 17:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1706578953; x=1707183753; 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=zBr/4NzQcxrA4rNO53TUlaG7d5zRLMT2JlV2BMAMPQs=; b=ZUX1zZBMYoQTsCXQ+ZyEAPb+H0ydTt/vd4Sh5a5NKAc6cJ+iFErnInAg5NQJpOmRGp DCF4TSEkVnJrmthTBwVlDvmIaoG0OSryMi/Ac9momNPhcbYcd4MexKIhuKA/HeNcKZ1K PGqCx+uuqWa1RQo2JMPLJb/R/PQavTi0kpaNPbvwB7+POv29jx04ddLaJ/gvJ6bl414y YhFV8iT8jtKUQPOlJpCM1Pwct/8bI2oQw2euxVPg1DYViLGDSBqrcSksOIcvuWt74vE/ GNxvoT3Fzfm2SY5iSZSinVl65fZK1Fjp70CblB2NQqyROndH7V4F52H6APl5GAQtjlSO xFgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706578953; x=1707183753; 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=zBr/4NzQcxrA4rNO53TUlaG7d5zRLMT2JlV2BMAMPQs=; b=A2lm7SuVCcKt140GZkqN5DRWle1Qfg5X9aKrvkQUpLMkG+K9dzQaBdSx99dXopvO6b N2HOHI0y1jZvb40QlniDrDfK2OBSO4OdHjvjN2qyaP4Q61EhNR/9c158091LhYfXE7y1 kq5lwyBL4Q/uZv3nGDbKXiVbpX4iLQuPlerhysdNqdlGKKC7t13qB682zL/Y/aef26FK jRms59fDTaK5gnGW0e1L8TF8pYlmc5hHBq0Xsfu/j7lD1IKxzv+bLPE5uCKEu1t6EFX9 PPiYNNKKnMOGREJV6RvqkBbww4YjXI3masDRCSDGE0on9jRvQrpj/1GV8rY55d2JeMfr pgxQ== X-Gm-Message-State: AOJu0YzLKaGV4AcoMvLqlyAAW+hGjn1XS+5bz6AyxV387By3pMiflNVL OibbHZXxYZ1O4MjecflnQrxqxt2EKnBP0mpHo4tv+ZTyAfb3Xx3DxoSshAvtOzA= X-Google-Smtp-Source: AGHT+IFnFy8t74gPrfD3nUEsIc6ZJrr+zQk6hXnBVgVJPyD5DXHBfSOXtvC3SYSy8pD3LO1UcyYHNA== X-Received: by 2002:ac8:59cc:0:b0:42a:ad25:21a2 with SMTP id f12-20020ac859cc000000b0042aad2521a2mr340871qtf.16.1706578953364; Mon, 29 Jan 2024 17:42:33 -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 bb36-20020a05622a1b2400b0042ab4a129easm236641qtb.73.2024.01.29.17.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 17:42:33 -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 16/20] mm: zswap: function ordering: move entry section out of tree section Date: Mon, 29 Jan 2024 20:36:52 -0500 Message-ID: <20240130014208.565554-17-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: 3A676C000A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 4u3f1fj7qu5tnwi4epfyt5ogjwe9gs3u X-HE-Tag: 1706578954-923695 X-HE-Meta: U2FsdGVkX19gA4m9uqubBk5chlquqWJo6sR1u4bUZqbjt0eKYgTf4UFPYpWdylKZpjjPnfzucQ7Uv21oInEzGnmTszBZTI2jW1pVFmh/hczi+Z++hMBqICn73VF9qmU4yuiNDjuKtqdSSp5BT/QpIp0Igzz+vLBf+ilpGO7gxF+4/BkxKSbdRxKBT+CJXA6T1574ERvlaLVDoeuTD8lYR2uwo/bXXNls7IWU9jSR1tCUV+xl9RNk1vzfnlo2h4DUctD07CJc6yWnsLSSeMiSgtUT3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WUm7gIvrDLGiPGUlSdfDrU3Vo3kkKh12QPhiLM6eZjTUYkgTr6MI3wP6aiAgrB1+ZkFST+tvFhQxg== 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: The higher-level entry operations modify the tree, so move the entry API after the tree section. Signed-off-by: Johannes Weiner Reviewed-by: Nhat Pham --- mm/zswap.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 756d4d575efe..80adc2f7d1a2 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -848,27 +848,6 @@ void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg) spin_unlock(&zswap_pools_lock); } -/********************************* -* zswap entry functions -**********************************/ -static struct kmem_cache *zswap_entry_cache; - -static struct zswap_entry *zswap_entry_cache_alloc(gfp_t gfp, int nid) -{ - struct zswap_entry *entry; - entry = kmem_cache_alloc_node(zswap_entry_cache, gfp, nid); - if (!entry) - return NULL; - entry->refcount = 1; - RB_CLEAR_NODE(&entry->rbnode); - return entry; -} - -static void zswap_entry_cache_free(struct zswap_entry *entry) -{ - kmem_cache_free(zswap_entry_cache, entry); -} - /********************************* * rbtree functions **********************************/ @@ -930,6 +909,27 @@ static bool zswap_rb_erase(struct rb_root *root, struct zswap_entry *entry) return false; } +/********************************* +* zswap entry functions +**********************************/ +static struct kmem_cache *zswap_entry_cache; + +static struct zswap_entry *zswap_entry_cache_alloc(gfp_t gfp, int nid) +{ + struct zswap_entry *entry; + entry = kmem_cache_alloc_node(zswap_entry_cache, gfp, nid); + if (!entry) + return NULL; + entry->refcount = 1; + RB_CLEAR_NODE(&entry->rbnode); + return entry; +} + +static void zswap_entry_cache_free(struct zswap_entry *entry) +{ + kmem_cache_free(zswap_entry_cache, entry); +} + static struct zpool *zswap_find_zpool(struct zswap_entry *entry) { int i = 0;