Received: by 2002:ac8:6d01:0:b0:423:7e07:f8e4 with SMTP id o1csp6620581qtt; Mon, 18 Dec 2023 01:38:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhQzwxX2kKH98tW+TE9C28dgYoZjHLkUGwZyXNDV0qmHT54vhBYEyHYmugRvBe4AdlzfdR X-Received: by 2002:a05:6e02:1d19:b0:35f:b0b9:be27 with SMTP id i25-20020a056e021d1900b0035fb0b9be27mr2413166ila.0.1702892335919; Mon, 18 Dec 2023 01:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702892335; cv=none; d=google.com; s=arc-20160816; b=KuQcF/4ZAzv9ZoNF7X3oIe7220S77PyNDIg7KTkye1qTHG5d3olN4c2c1bUaaQ5cng W+C0fFzG567SB09EiVFPvO9c1t8OOY/m6aIpwuRcGSfwEM+HQ1sANHUHZXQf8NYfNrpq tVGvotU8vhy4zbmP1HLT2B1KTlrUMsB2x2Sg+5V6LLuiJoS6JQM/BpCRju4f74H2dOqQ AizKTq4659kjRuoL35iqjJvbn01grWoj6FtbutrEPNfO2gfMb46sI6UcL8R6dacl7lwk QHI/isxYdNK8UulOd6YOqvKkpeDw7AqH9uDy//jVpr/HSi5tqiNXOoXTIz3a2Iy7fU7B mxZg== 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=xZ8Fi2dLzLbYy4lYxo2rawHPEVgmeyvbO/CcjHbsVvQ=; fh=CIEK4oU1VpeGYez8Kqg5XgL7oVBF13djoAg0dYB/DRs=; b=tEHPVZkouAVYB+hI/UTh3CtV94b65DuBEBOOx0xPBeVHF+9rFYAmjXecsO7zObhZyS 6pnYyofdV3srcZKoP/i7zZlqwAo6/5Rx7jueXn4vBVBxMqn0B/GMcRDjbY1RyFndSg1K rhdH8kV96jwxbCiiqf3vazflbv98VdWgvu1HfitavEoq/h8bZfkwuXwe1JJKwYV9hziL 5RyaL5MiMp2ckOd0XKxNlFL0lUMemWSCp/kjRHTSFGhrlFIQ1L6NrAyLEdBL9JOyzj8Z N4jP51nQtGF2T07UUylqB4rz1A2oP3k1W1/6U9kiOdP6z7NwlZr7Xp7cpEhQdE7FVwy/ 0TaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=xjNdV0BN; spf=pass (google.com: domain of linux-kernel+bounces-3255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n11-20020a63f80b000000b005ca409a5fefsi10282555pgh.643.2023.12.18.01.38.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 01:38:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=xjNdV0BN; spf=pass (google.com: domain of linux-kernel+bounces-3255-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6AAF9B223EC for ; Mon, 18 Dec 2023 09:38:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06DEE125B0; Mon, 18 Dec 2023 09:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xjNdV0BN" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 C6FB9125A5 for ; Mon, 18 Dec 2023 09:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-54c79968ffbso2856998a12.3 for ; Mon, 18 Dec 2023 01:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702892321; x=1703497121; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xZ8Fi2dLzLbYy4lYxo2rawHPEVgmeyvbO/CcjHbsVvQ=; b=xjNdV0BNsJIACFqS39qr4panlvmQmAzWP/fpNwkWAZ4KDhSybnzj6CGKvkfAzNRLer TBy+v1vBEx2FMFjcpmwE2tzs7IbFhWz5PbY+HTuTC/q9cHVmAlolfIGOtDrGiJxT+oCB dtFppE7nOZmuINYaL7UVDkuXqZhMkkRv7LemqsOT46+BND6vVzLEltnOTXK8E1ojTji2 Mlz1lU+sKKjv70Pkw8VKxS4CS/7xrvj9e0HhK19wW/U4AyPVNfnYD+SmF+Qe/ASJV5oL oDh5l5ZXf6xAcSajrdJjVa/PfuaM4fQKHCJQAoH5AIiapYu81cC4UJgdjcbSs2TN48az 5blQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702892321; x=1703497121; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xZ8Fi2dLzLbYy4lYxo2rawHPEVgmeyvbO/CcjHbsVvQ=; b=KOtZqbR+KQyqw3FtiZet5o8Q5n4l+BEqFYA+EGiss5vKcTU8mmsL6Nu5ZM5OfMOTX3 2DHfAvRhNk1TMph++017o5f/Wm5yxSkCgZOBfvVE7D/3+ZwU5WOK6LA6HVNsjtD6/zrU Ifty8QoiELlHBra4YP9mA50vvwJXwG4IT+eC5Ld4d3K1HJTjT4oavecph4OmkzzO/cIT IzL5IOkTwdWg6wkNZbFgzLKW+1yrcqoCvEaVi2IiQ54cn/pP3AIsgy3CUGXk5GKurjyV EVzlsvVwI76PULVrm/TzX+66MswB7bre3I3ll1BGzTdSijDMY1s4DZmCk4Y65IPgyMt1 D7Ag== X-Gm-Message-State: AOJu0YxXgG5O9CA6vp7M45Jld3BZPe0rvW8xuq7588e7HaJWx0ACMfQz 1kgB08wgJFdAblFeZESf/pxRX3DZh0bfGzSxc07c5Q== X-Received: by 2002:a17:906:7388:b0:a1d:b6b5:3416 with SMTP id f8-20020a170906738800b00a1db6b53416mr5657636ejl.84.1702892320732; Mon, 18 Dec 2023 01:38:40 -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-v1-0-896763369d04@bytedance.com> <20231213-zswap-dstmem-v1-3-896763369d04@bytedance.com> In-Reply-To: From: Yosry Ahmed Date: Mon, 18 Dec 2023 01:38:04 -0800 Message-ID: Subject: Re: [PATCH 3/5] mm/zswap: refactor out __zswap_load() To: Chengming Zhou Cc: Andrew Morton , Nhat Pham , Chris Li , Johannes Weiner , Seth Jennings , Dan Streetman , Vitaly Wool , 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 12:15=E2=80=AFAM Chengming Zhou wrote: > > On 2023/12/14 08:52, Yosry Ahmed wrote: > > On Tue, Dec 12, 2023 at 8:18=E2=80=AFPM Chengming Zhou > > wrote: > >> > >> The zswap_load() and zswap_writeback_entry() have the same part that > >> decompress the data from zswap_entry to page, so refactor out the > >> common part as __zswap_load(entry, page). > >> > >> Signed-off-by: Chengming Zhou > >> Reviewed-by: Nhat Pham > > > > On a second look, there a few nits here. > > > > First I think it makes more sense to move this refactoring ahead of > > reusing destmem. Right now, we add the destmem reuse to zswap_load() > > only, then we do the refactor and zswap_writeback_entry() gets it > > automatically, so there is a slight change coming to > > zswap_writeback_entry() hidden in the refactoring patch. > > > > Let's refactor out __zswap_load() first, then reuse destmem in it. > > I tried but found that putting the __zswap_load() first would introduce > another failure case in zswap_writeback_entry(), since the temporary > memory allocation may fail. > > So instead, I also move the dstmem reusing in zswap_writeback_entry() to > the dstmem reusing patch. Then this patch becomes having only refactoring= . We could have still refactored __zswap_load() first by making it return an int initially when split, then void later. Anyway, it's not a big deal. The new series looks fine.