Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp471976rdh; Tue, 19 Dec 2023 04:48:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHeC7pkRjTdD0rk4jna5ms3qhF5+l2pDV+tmxldJAQyPei6NKdAWH7UvLc23tg9+puGWnm X-Received: by 2002:a05:6358:419f:b0:172:ac49:e9a5 with SMTP id w31-20020a056358419f00b00172ac49e9a5mr9732194rwc.49.1702990122872; Tue, 19 Dec 2023 04:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702990122; cv=none; d=google.com; s=arc-20160816; b=0KN3SvkR4lPWAfw6QskaBtaTYUaRMOLsKlWtUKvtyxwFbqwAVPxdtAKJpF0SdBCAJS UheunT2JXn9M3ATu5Ry0WcxSfX0JPzJdQZ9a7jJ0AhPE10xIHxJznkuqluD9Ye3Agl+D MzzXjBxsI0R8kaCqooicAryZpngPEv96kbuD342xKf3O6yrcbbDGJCukf4GtKSGFCVmL HC1siscRQFEWwxmVhHeFUBZIu63ZZxkJi3ODYlry0NYRZztw3A3T8WcLW0mrEXjXjbvo GHQfRLSkn2HPvHg9pGrVg/yvMa/GlZKhcxbN32w8TPbyX/IBcS395fINC8R7m3w2Mcfn 2MMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=UWAQk1G3KTdX3NKnJLL0oqqFo5tshXSINqL5yX0a2hw=; fh=nJTO9b6ZfxAj2RN86UXVN2bup1NBlxRS9JT5Bkt3TkM=; b=qzEcaezPyRXEAKeX//uN2/yFw9gz0r4nk/GFgbVeuORCB/5hmlup6078H2Bhc9FxNv IONXCBJ9vR3nQYGSgnIo5Jta65FC8+8bJy+gK0O5B5+m2+CRSCZav1VlVkQ4T+8b1INj 1R082EkzGphlxPeRQNqM/iaqP2ZMhhGpMC/d+ws23tn0r+YPg1kAkLUfRRwznkQiegGs 4QMKSkBzSbAqorOlC60pB1Y6bBAPErAD7NWQBUAdAeKlA3QV7zngi2d07CFGjylBJbdt Blxg3wYUD2hdBn+pMKKojFWcqFpGgArcUuCHUj9aBsmtO+gtTxgcRd1iZBz2VKM8N1HW y2Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jRlvAXUP; spf=pass (google.com: domain of linux-kernel+bounces-5199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u16-20020ac87510000000b00425749ae2b4si23767577qtq.481.2023.12.19.04.48.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 04:48:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jRlvAXUP; spf=pass (google.com: domain of linux-kernel+bounces-5199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 991C31C241EE for ; Tue, 19 Dec 2023 12:48:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90C511A5A7; Tue, 19 Dec 2023 12:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jRlvAXUP" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B255A1A287 for ; Tue, 19 Dec 2023 12:47:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D6DCC433CB for ; Tue, 19 Dec 2023 12:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702990047; bh=hnFmc+s8sR5Tye7KepwE2+51ZjDZCNpery1XwfqQ5F0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jRlvAXUP+1kY4QMJTKSXR/xxbNRW8HMS8vmuY/SHgxSH96hz9NsXqUwlVvIg69m5o 0zl4BHCdPgqAaJ8wZKcdyZCUrGhrZ9+XelrYMbbAzyJf6BcqJ1HpdW+RY2VNYicUVC lRqSTI4HGQchFRUGJNDtpqWF26XVwlbpYIkWkZUhHNggUQnEZK+I+VPcW5M7e6jFUd A/jB2WOvcqJcXn7iXekaQj3StDLPU7sJjqLRgt9F1o2x5vghQuEyO48nAqt5HenAf5 MRgc3+omDjDckG+PTJUTdh6r8y6bXKzu8MUM56q6qcJjdWeCtI4FoYZFO0BEucb6xR sks6WiLQe6jNQ== Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-28ba18740d6so1305509a91.1 for ; Tue, 19 Dec 2023 04:47:27 -0800 (PST) X-Gm-Message-State: AOJu0YxjN3XMmlJA/WZAOkYu5QumfmpneyyzgnqDacrM5gnCpQJJ+Qru 5l1uzFD1NsupVOWU4naDeWqlTfO1T4rAL8ryJDZrzQ== X-Received: by 2002:a17:90b:2285:b0:28b:904a:93f2 with SMTP id kx5-20020a17090b228500b0028b904a93f2mr2011222pjb.32.1702990046576; Tue, 19 Dec 2023 04:47:26 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com> <20231213-zswap-dstmem-v3-4-4eac09b94ece@bytedance.com> In-Reply-To: <20231213-zswap-dstmem-v3-4-4eac09b94ece@bytedance.com> From: Chris Li Date: Tue, 19 Dec 2023 04:47:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 4/6] mm/zswap: cleanup zswap_load() To: Chengming Zhou Cc: Seth Jennings , Yosry Ahmed , Vitaly Wool , Dan Streetman , Johannes Weiner , Andrew Morton , Nhat Pham , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 18, 2023 at 3:50=E2=80=AFAM Chengming Zhou wrote: > > 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 > --- > 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 =3D 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 =3D kmap_local_page(page); > zswap_fill_page(dst, entry->value); > kunmap_local(dst); > - ret =3D true; > - goto stats; > + } else { > + __zswap_load(entry, page); Very minor nitpick. I think this change you only take out the "ret", you don't have to remove the goto. Personally I prefer the one with the goto because If (!entry->length) is a rare case, having them indented match the normal execution flow is the streamlined one without indentation. If you keep the else statement without the goto. You can move __zswap_load(entry,page) to the if statement so most common case go through the if statement rather than else. I also think this commit can fold into the previous one. As I said, this is minor comment, it is your call. Acked-by: Chis Li (Google) Chris