From patchwork Mon Dec 18 11:50:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengming Zhou X-Patchwork-Id: 13496761 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 997CEC35274 for ; Mon, 18 Dec 2023 11:50:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FB3F8D000F; Mon, 18 Dec 2023 06:50:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7810B8D0001; Mon, 18 Dec 2023 06:50:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58B268D000F; Mon, 18 Dec 2023 06:50:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3E5578D0001 for ; Mon, 18 Dec 2023 06:50:52 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1D745160247 for ; Mon, 18 Dec 2023 11:50:52 +0000 (UTC) X-FDA: 81579772344.21.CBD7783 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) by imf04.hostedemail.com (Postfix) with ESMTP id 2E66C4000F for ; Mon, 18 Dec 2023 11:50:49 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.178 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bytedance.com (policy=quarantine) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702900250; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zJqTjnZTPjIHItkHechsbAK+vOUzSf9pl11pwS87u1M=; b=5SXcAqZiHXlzG9tXYE+O+nJHbyiOQzpMVL4DKIjzsM66a1E3Mzt2iNMnoXUpZKAl06+ydW 1s58KqrbZIjuoJKIh7g8gdDfCsjMd8J1XhsHWBfHwIeL3E5OuTLyVeiu4gYkTnxMFX13kc z5xYB6k0fhNKyD0w1p2jg3pZHIBhIM8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702900250; a=rsa-sha256; cv=none; b=pizniACf318WatVkl1zN7Ru4Xa/Z20FDif1j2984d48x/xXo6WYvFtYVb7b7UgejsiMJ+S HkETCiRVBZiLwsIEv1axLHxWXKh8wfDt/uBxVNW+3+pCMFRgGcbvtlQUNhhAg+0OypcwTb aUD4i6eWQOfgzdYJkM1Jvauf9SnPuyA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.178 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=bytedance.com (policy=quarantine) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou Date: Mon, 18 Dec 2023 11:50:34 +0000 Subject: [PATCH v3 4/6] mm/zswap: cleanup zswap_load() MIME-Version: 1.0 Message-Id: <20231213-zswap-dstmem-v3-4-4eac09b94ece@bytedance.com> References: <20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com> In-Reply-To: <20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com> To: Seth Jennings , Yosry Ahmed , Vitaly Wool , Dan Streetman , Johannes Weiner , Chris Li , Andrew Morton , Nhat Pham Cc: Chris Li , Yosry Ahmed , linux-kernel@vger.kernel.org, Chengming Zhou , linux-mm@kvack.org, Nhat Pham X-Developer-Signature: v=1; a=ed25519-sha256; t=1702900234; l=1470; i=zhouchengming@bytedance.com; s=20231204; h=from:subject:message-id; bh=1eOM2WlTMMQMFmZcsE6sU450y2r77yOSYBMqqAB7HFE=; b=mA1a+oM0pO2x4ySl9ZU6T4A1b2XOYkGKZpXj4gIvy56X1aoJsXnojsb8m/11LLzDFIBsJEhQx i+goKQs7a1CAJLnNJrSVIiCo2UaAEaJ/sfFe3MjPRQ5aHJnbPdiJDGR X-Developer-Key: i=zhouchengming@bytedance.com; a=ed25519; pk=xFTmRtMG3vELGJBUiml7OYNdM393WOMv0iWWeQEVVdA= X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 2E66C4000F X-Rspam-User: X-Rspamd-Pre-Result: action=add header; module=dmarc; Action set by DMARC X-Stat-Signature: iu6me38tp79wnf5kh96hzmuaji7fspha X-Rspamd-Server: rspam03 X-Rspam: Yes X-HE-Tag: 1702900249-466608 X-HE-Meta: U2FsdGVkX1+AVf4Vvep4YOW+CYYqt8QPRZfsS/8b3Zpa5PFAyxgQuEE5toCSIGc0zM4yoHfufZAKF/HxK+Cm3awHBhd9JcaSLKjonzFcJJwNjZhDomfDjmLFCtRaDtX5rdY0aXW4f+PblRHFAwf7draEG3ixLO3vV/LBMyO1wJCqUHgA4QL+Lq27br1X8lQ7mEQufjP1bbsNvHLP8dfXR5EcjeOrtoSSi9fVwtOwGkqGl8V7hwd7YX2Bq15bfCW+RphXtsxp4xNn/9HhofMXrV0IXcSw48f2Cngl2SdBuEVG8GI4SPYnXEgkw9hQ/Za1ym2aE4myHTjLIaWz3tUWzcyz48E9/OjXJiuOwDX9jih+/AIkTYnIHhFIIHjBYNfqhppD+IVW12abV615dJxihjOKYvJjpy5sHwRKBejGudlA1oyOVI5ZxSw/QiRRjyWq4Z16txtU93JUOTR643/2l4p0sZ+Ae/+o6s3dxYBXV3f1qUamdy98mOlv5bmyaNxcxHaMpvWYmpP+M607RvBeXkUCjHP4cWuY9hwJhHR+YkLB1sjARJ2VIU8geta+E4aS1RKZa6n9xVXqU5hCNVrsyhBPjaNNoS4yETNcEh0dHRQvQt1WmqaILZKFLbQXqw66DuaopRMDqL/fMz866fVv7f82SjqKycTFp7N8hu+Z/GoCNRmEoreu/R6/ULVra79j/CmCvCX0G+83Tgc+hcRyMmIzYCqo08rgxpBVPFyCv9i32boqcHv2LAcwQ2cCQkuc+Z0+3WXz4eiTZLq77SuLKFThgs0QNgpxMEVrrbTTAxG2wHfEnmTdcLPnNchjvv+nfuoIOlVvmvtgx/VFnhgS79t9FH8lRCArqox3NYyPiufeir/ivQ8gSu7sSDfbjRaY3kGr+8tRllL/szgS9nV5jsvKaOFnyIZf2vZ6A/D0n+VUTSSeLAcppVY8WJG2rs1MGG/0BxT5M7QSVVH6EIj K6bOfTF1 rtvGaIPZAeWU8BUvmtfugVVtZmCLRRcLIaefkVoQ7nTuIu2nsp5KUL8MvGE9y1Ca9pfB/51l4yIVQIQiT45N61ixtqcfXxV+Hn4xDbivDtR6sC9WzE3wpmvWuIiLUgnK5W948k0Fr4Mnol3yIuTXkDkfiNSiqpOKvphIXkDRK/RWV2R+TtGmMmpIiFaI3tcfMvFdtcxths4xAPI4HNUiUwd4aWydDMfWgiZjjd3/HmPNOO/+yq2jru4ZbgAP7rmQlDWleYGcZJ0QfOmaWCRnnqvATX2A4WmDde2Ti6PWEEUlC35nceEvNZ069OZO1Nd9CJdKUYvgMQ2uklvT5EZa3yKwINH3iY6ffL7D+wQEo//nHL5SAsbgGxMKhbgQEpwPp2BMTJNgYkWSelpo= 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: After the common decompress part goes to __zswap_load(), we can cleanup the zswap_load() a little. Reviewed-by: Yosry Ahmed Signed-off-by: Chengming Zhou Acked-by: Chis Li (Google) --- mm/zswap.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 3433bd6b3cef..86886276cb81 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1759,7 +1759,6 @@ bool zswap_load(struct folio *folio) struct zswap_tree *tree = zswap_trees[type]; struct zswap_entry *entry; u8 *dst; - bool ret; VM_WARN_ON_ONCE(!folio_test_locked(folio)); @@ -1776,19 +1775,16 @@ bool zswap_load(struct folio *folio) dst = kmap_local_page(page); zswap_fill_page(dst, entry->value); kunmap_local(dst); - ret = true; - goto stats; + } else { + __zswap_load(entry, page); } - __zswap_load(entry, page); - ret = true; -stats: count_vm_event(ZSWPIN); if (entry->objcg) count_objcg_event(entry->objcg, ZSWPIN); spin_lock(&tree->lock); - if (ret && zswap_exclusive_loads_enabled) { + if (zswap_exclusive_loads_enabled) { zswap_invalidate_entry(tree, entry); folio_mark_dirty(folio); } else if (entry->length) { @@ -1798,7 +1794,7 @@ bool zswap_load(struct folio *folio) zswap_entry_put(tree, entry); spin_unlock(&tree->lock); - return ret; + return true; } void zswap_invalidate(int type, pgoff_t offset)