Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp520566rdh; Tue, 19 Dec 2023 06:08:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU4IZX9d98jAUaO8QGFrhItgibDvF7RhAdkZVcHTWrB/67jBQGIDLl9Nip1Vg7ET2ipLxI X-Received: by 2002:a2e:9084:0:b0:2cc:7c8e:2f84 with SMTP id l4-20020a2e9084000000b002cc7c8e2f84mr788161ljg.38.1702994902609; Tue, 19 Dec 2023 06:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702994902; cv=none; d=google.com; s=arc-20160816; b=b89ahQ+hBRzBMWe4f5EaCqYY/wh/ZVGt7hE15FlGQMPFg/oKYiCsH2M1ny91tOk4DQ tBSzBwF1gay6jEMP7RSSEJAVjYrBMQiyMy8BwPGid7HiXjp/3hFlzaaQ0ZWhu6LA+TPa aWSlByScEJZvObcZIZ4e6m61hTba0t8Dd8dhz/JfDBrCO0DmPV+UQ6zLdbHvzSrjRkQW w2ZDdU7uKE/c4ViJyWPGBlJoNv+OFNYemoBXTdYaH1SXemoP3EqorWq6aJQt1zde0Yo4 s6rz/JWtd12yDXRpMuIPqQwJAEe25wVGcbX6zxAao4tQpdoVw3ZKP9bzORsA62e3x4/I I1tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=58GcE9Z/uz2j3e713mEO6HJcPRG3l2oQcTHcq8xiCnE=; fh=bRfnd1VXN/ELagA8NWbvtQLJZBj0tCt0dU1fW83Z65g=; b=dFUDbcDCYcVuZ5FYtda9YOKuNHIYpjyePJl60c/bL7iTMWzxIncVk9mSL6IJ5aqC/P 7b/8xjenVbXe80zbWMxiucsfYX1F52W7+Ud5wRnGjsrFQfVoJTMUAJIB204SfAUwXa2u Jl1MBLVmeeTmLJkhIGALqLOwususKGpW33RPLECwM4rgFCaBs0ehwmmO2VmG5Jypb3L2 IZICF7lu+ZxMBE6lU1D5rCI64DERd3G89HjRWT/hrRReBuBIyWFIZBX/0+7OUMBATX+O wSL87LrbSsj/+MzvdHLUXJCtywsyUSy1yBOjD0beCUilx7NmeMks5xANleYc9gHWUxR5 2b2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=OwCPXOOH; spf=pass (google.com: domain of linux-kernel+bounces-5318-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5318-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dm10-20020a05640222ca00b00553af6b3c18si126333edb.332.2023.12.19.06.08.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:08:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5318-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=OwCPXOOH; spf=pass (google.com: domain of linux-kernel+bounces-5318-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5318-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 578AA1F24E36 for ; Tue, 19 Dec 2023 14:08:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 138181BDDE; Tue, 19 Dec 2023 14:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="OwCPXOOH" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E53F81BDE6 for ; Tue, 19 Dec 2023 14:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6d940d14d69so117946b3a.1 for ; Tue, 19 Dec 2023 06:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1702994891; x=1703599691; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=58GcE9Z/uz2j3e713mEO6HJcPRG3l2oQcTHcq8xiCnE=; b=OwCPXOOHaoTvjIjhMtwJgp0fkojQ1Zcm/odV1QCxDjvDPrGllQg9nq/Aw/I+n9agAi D8X0d9QxM0T3kxhdnL7qDVmJANC8ow7vE+BVTAQkhe52qUVbeweUTULPF+clbCF2uTxI i6rt6oOY3xzw0GVoINuYVWQhqR5OjpcMfw/BXU/OUrNSObFG+VAxug2cXtxEc6o8wPcK A2yFAcTXD7C73wEc9oXj8GD2r44WkGmp57B6gRkDEW9F24PwvdPOPewe8KeThCSwPx67 yjv09WFd4UPuSegmZH9B4chg8YGMPuBHSTf47/Ntx/nLrIo9Kv9w5Eso1JyGXH60bjJn 3T5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702994891; x=1703599691; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=58GcE9Z/uz2j3e713mEO6HJcPRG3l2oQcTHcq8xiCnE=; b=isErEa7D4mNRdn5XYjmZzmEtaLodTf3H7u7W47u1wt2YMdandKsvJCJqBqdP6eRrOb hQiqvDcRGcLK1yv1Ta8URL5S3okzTW6yXwL/l3790h2RB0K6do3YqQJtTjcuEKSW0Fm/ JU1MnMnemFiMUBHnsgodhlLYcK612UCwsijndHrcoR/b+PPeT3mON2wkZ1UeHkbVo4bI GUCQAoM2tNAUggOEEsfx3s3/3097Ps1pLc+yDHNlCxDN4u8QS2TYmdsTDnyncmgxcSMF 9neJ123I37TlWV9dJW+PyJuJkrEiFYkop8xnXcXKe8Xq3O9nphqus7jAX1+bTsNHVat5 smBQ== X-Gm-Message-State: AOJu0YzUCfPjm/v5TRoiU9+An1YY48XONIasA1+455bD0CTP7h5GcErR 7unk/VJ+JxCF2xaZYgsNA5ktCA== X-Received: by 2002:a05:6a00:9a7:b0:6d7:affe:100d with SMTP id u39-20020a056a0009a700b006d7affe100dmr2434859pfg.13.1702994890904; Tue, 19 Dec 2023 06:08:10 -0800 (PST) Received: from ?IPV6:2409:8a28:e64:34f0:b832:9c5b:158b:a863? ([2409:8a28:e64:34f0:b832:9c5b:158b:a863]) by smtp.gmail.com with ESMTPSA id gu18-20020a056a004e5200b006d9415b769csm191274pfb.169.2023.12.19.06.08.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Dec 2023 06:08:10 -0800 (PST) Message-ID: <66b3f3ec-7146-4763-bd51-bb48ebb4ba95@bytedance.com> Date: Tue, 19 Dec 2023 22:07:58 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 4/6] mm/zswap: cleanup zswap_load() Content-Language: en-US To: Chris Li Cc: Seth Jennings , Yosry Ahmed , Vitaly Wool , Dan Streetman , Johannes Weiner , Andrew Morton , Nhat Pham , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20231213-zswap-dstmem-v3-0-4eac09b94ece@bytedance.com> <20231213-zswap-dstmem-v3-4-4eac09b94ece@bytedance.com> From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2023/12/19 20:47, Chris Li wrote: > On Mon, Dec 18, 2023 at 3:50 AM 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 = 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); > > 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. Make sense. I will change if a new version is needed. > > 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) Thanks for review!