From patchwork Fri May 24 03:38:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13672649 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 5C900C25B7D for ; Fri, 24 May 2024 03:38:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E12EA6B0095; Thu, 23 May 2024 23:38:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D73A26B0096; Thu, 23 May 2024 23:38:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC6A56B0098; Thu, 23 May 2024 23:38:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 97F7E6B0095 for ; Thu, 23 May 2024 23:38:26 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 511FEA1233 for ; Fri, 24 May 2024 03:38:26 +0000 (UTC) X-FDA: 82151881812.09.4D8A85E Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf01.hostedemail.com (Postfix) with ESMTP id 890AA40013 for ; Fri, 24 May 2024 03:38:24 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=V+tpol+9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of 3rwtQZgoKCEA0qut0cjogfiqqing.eqonkpwz-oomxcem.qti@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3rwtQZgoKCEA0qut0cjogfiqqing.eqonkpwz-oomxcem.qti@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716521904; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BKVO8Lg92AmjXALe4s9SIU0KV7xHA1puZ574BkfEyc8=; b=APs57SICHq/NCnDPId6jZAfFvQ1yy2CDi/hO96t4e0NYm5/uV0yGXhSy3gQUOvGc1JJWDW 20jT3ZcwIR2tP4l0zhWF/lOZyMv5Gxj3nX5cIjZgqYauXkVm6vSILXsjuNIj6aV+WPmRTc i7JYKggSq6hxI5RykYkb8n7ruB4S1KA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716521904; a=rsa-sha256; cv=none; b=i7r8rPslzMcZetSioPNG+VQkNAjSKAM2WhaWfjLoSIHkjoU1R1HJtrVy1thCwd+31jvThJ 63WF6RPvMCb41qn+MUcKiWNq62hWX6f+hVDnfiAp1dfcKxlmirkAOspeujeFyNFZ1twyul i899J0WcYlgHHxgJX3jhgLdt8hN0MAI= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=V+tpol+9; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of 3rwtQZgoKCEA0qut0cjogfiqqing.eqonkpwz-oomxcem.qti@flex--yosryahmed.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3rwtQZgoKCEA0qut0cjogfiqqing.eqonkpwz-oomxcem.qti@flex--yosryahmed.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a0827391aso8863097b3.1 for ; Thu, 23 May 2024 20:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716521903; x=1717126703; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=BKVO8Lg92AmjXALe4s9SIU0KV7xHA1puZ574BkfEyc8=; b=V+tpol+9BcEhW5o1wFhSDkhjb0mNzRfO4lG+HnI4VzI6L7WtC+ot6SHDYPRWNnkfBu tZRwowy7i6IcYoxQf75TSmZe8gq0DVzFepv3oPUgzFLbTirTAw8yECYDZv2amKCevII6 72GWddcGMOTbKChpOL3x/7it/hRvs+3oze0SkBT1zPnlZEAKlGZH/tXxjMdbzbbrPplG jCeO/Ug1v/g6ZpqN3CqOJ7VxjGp1RIPt6tUHT94AwFr+WSKpRXLkwTXK7IwJ4QkDrZWD /O4i1kiSixzptT0H1YLyUY3oeOqU6GN+wWReETMuS/y14HFl47XwUR8lv2PxpSSpYoh6 RyPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716521903; x=1717126703; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BKVO8Lg92AmjXALe4s9SIU0KV7xHA1puZ574BkfEyc8=; b=dvXCHgSs1fpb+wC264OSKMkyGiYNFFyqVmv5vhNJrweNXLWPwVO5SBIrn/coiP5fpr W9h0O+vXnHCap+ak/b3NoJVojUpZPXPs5f77CECtt7VMBKiiXRz9TzdqLpVMs9ygADYd ZldhGRGOQWwpGAzUHnK9k89ArUyX6sUkyfrTBXoz0S5nSYBy+HfsnSmSCQErwlz9S6GR aL4tSGVyRO8gESELX4ZqkwfKUXlzQM3w9u/x8RpAtOESom5eLZNYQqdIR5YGOjOqcjhR ut8/DfB/RrEt3qeKrtRJf2tu5d99S9o+nfzmf3A46IHHtsNUG72KHs+0/gRmCmnaxQPV vs5A== X-Forwarded-Encrypted: i=1; AJvYcCW//NHEYxfozNFbWi7kxFWsaAlKM7pwcwd6BYYWuSvohN0PgFEKXXLl4pvLtSzNW3pKYc/ZOORGxr5jk0sJHA4hoyw= X-Gm-Message-State: AOJu0YyEsH/HfRoXk8uzIDW8JQepuJuUn25Gnub+c5673G5VUvHAWZdh R0dkA1XKDqpvWuORSsQx6SnnIjX1rfI7VVjF+Kbb1tsA4HuBxvvfh/vQutvIoWPqkJ57DptLifQ qD67k13Bk2BQYNqI8Ug== X-Google-Smtp-Source: AGHT+IHhQTjQkcadv7LLw0o2LYVFVoSUew57m4WVVk3eNvQWrYHyn6s4HbwcRHjmBZKSrfn/K2ulbWyVZYjxfkro X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:690c:281:b0:627:e226:8ce3 with SMTP id 00721157ae682-62a08f828cbmr2774657b3.8.1716521903699; Thu, 23 May 2024 20:38:23 -0700 (PDT) Date: Fri, 24 May 2024 03:38:16 +0000 In-Reply-To: <20240524033819.1953587-1-yosryahmed@google.com> Mime-Version: 1.0 References: <20240524033819.1953587-1-yosryahmed@google.com> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog Message-ID: <20240524033819.1953587-2-yosryahmed@google.com> Subject: [PATCH 1/3] mm: zswap: use sg_set_folio() in zswap_{compress/decompress}() From: Yosry Ahmed To: Andrew Morton Cc: Johannes Weiner , Nhat Pham , Chengming Zhou , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Stat-Signature: 6jkke61xceq4bdwy3i1tbpd47rods7jb X-Rspamd-Queue-Id: 890AA40013 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1716521904-153988 X-HE-Meta: U2FsdGVkX19PevHHMgpMvXpaIrutPPEK+wT7JVIL4HmEA0IpyGgw2/6Xbhvxk1peXJ9c9mobK8UNxtoeaMzUf5xswZmciUfbK4ZtctJr+4bw88NBWRvoO0JTX+PHai2yVHFzXYjbIVRqS8MsocXS88RMRfHdeMJVXSHNMFnV8AZjfG/IIieaS42JBjbQFlBXQ+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E3/bhA/szEsD2rvqQJKFYnSrQwEvzWuw4nNASOopwYjoQr+859ro/SfosnnaWvdEwuM8U92ND0g9LvE+8nmpzbprHwp4e+SmPUrsB/lzr8yGmyhkhAbWPMECjR6ToE8+Xyv2x0Dj+V8v+e6bVl6pYl8kDuQWT4Tm6ETOV0690Bv1tMvr+LVzuh0bB98zxh7DyCqtD4ZequnwQSam15C3EkTXuD3Zz6ZXVz6FtgGTles7TcNLmg401BzpTt3uT+ZO4klyCg+ic+WImdUQOFbZ/KIDwsrPwlmNjx43DIkZZQVMsA8HPemKF8VowYbWYFGB/cBllyigFWSMs8WbXGSnwIl7WrHcqcL0NtCnoYQlkbybqTToqTvviO6pEE8EizMdA2SW/txTM+xYe1mTMwIVA== 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: sg_set_folio() is equivalent to sg_set_page() for order-0 folios, which are the only ones supported by zswap. Now zswap_decompress() can take in a folio directly. Signed-off-by: Yosry Ahmed Reviewed-by: Chengming Zhou --- mm/zswap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index a50e2986cd2fa..3693df96c81fe 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -917,7 +917,7 @@ static bool zswap_compress(struct folio *folio, struct zswap_entry *entry) dst = acomp_ctx->buffer; sg_init_table(&input, 1); - sg_set_page(&input, &folio->page, PAGE_SIZE, 0); + sg_set_folio(&input, folio, PAGE_SIZE, 0); /* * We need PAGE_SIZE * 2 here since there maybe over-compression case, @@ -971,7 +971,7 @@ static bool zswap_compress(struct folio *folio, struct zswap_entry *entry) return comp_ret == 0 && alloc_ret == 0; } -static void zswap_decompress(struct zswap_entry *entry, struct page *page) +static void zswap_decompress(struct zswap_entry *entry, struct folio *folio) { struct zpool *zpool = zswap_find_zpool(entry); struct scatterlist input, output; @@ -1000,7 +1000,7 @@ static void zswap_decompress(struct zswap_entry *entry, struct page *page) sg_init_one(&input, src, entry->length); sg_init_table(&output, 1); - sg_set_page(&output, page, PAGE_SIZE, 0); + sg_set_folio(&output, folio, PAGE_SIZE, 0); acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length, PAGE_SIZE); BUG_ON(crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait)); BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE); @@ -1073,7 +1073,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, return -ENOMEM; } - zswap_decompress(entry, &folio->page); + zswap_decompress(entry, folio); count_vm_event(ZSWPWB); if (entry->objcg) @@ -1580,7 +1580,7 @@ bool zswap_load(struct folio *folio) return false; if (entry->length) - zswap_decompress(entry, page); + zswap_decompress(entry, folio); else { dst = kmap_local_page(page); zswap_fill_page(dst, entry->value);