Received: by 2002:a05:7412:b112:b0:f9:3106:f1c0 with SMTP id az18csp114402rdb; Mon, 18 Dec 2023 00:16:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQE7d7VM1L0dkyt8p9X6ltiOuwzTZj66byzlI8Fv/iZyVKuLB+p1OrbN7Cc0uxIBGNrf8G X-Received: by 2002:a17:907:8d6:b0:a23:5b08:7524 with SMTP id zu22-20020a17090708d600b00a235b087524mr385193ejb.11.1702887374721; Mon, 18 Dec 2023 00:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702887374; cv=none; d=google.com; s=arc-20160816; b=ntpSeO6lI6myYKD89o3TEKYyhMRyJBQxdzKqJ0TOaCTKFCuRhMXVOBykR8c1Rpy9zk BixWA0NctB1tSSsPUbZqFNEKU05JgF8UzjULVHYnAHWQThsv0872jH/xVncHYS77zd0V Y0TV0oiYj4zRMwLHfi1+cmbDyNMBn7wirSJWYvfPpqdTf/55Wn2wy3cYHujqyqlGA+95 Sj32arrh8v8ElJcZx++WvuLgIOOX8k0ezmAol3w8JRnpIqY/kO3c6A20gEuw3LOT1K52 TXIxPy3CCI8fFlCYsGmhobK0WU7pM6RkrSJ/zwkzk6wan56Gk6sIsTvInmEXGB2Xmvsz VnXQ== 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=84QetDdy0YwkTJVlaghRjx9Y+piF3q674vdNZK8rIls=; fh=eH0M0qAYd7VGluGVVC/tV4CNethGoIwXWs4p7/ljShk=; b=0OmS0VAhzRoWkJgGDXMsrV0F9qbV8CdW5qOG1I7DvJ/o4PDLYW7GUSwqe35xiSmMD+ yXhkyL01qRE6MyoHBoEyQPwJwW3lqAc/JaHGVsMh0opUnds7qsTJs/A6ke7eFNbTUBeo fBWUQz3mqvLiRENOsO6AMDHKDDLA+N0M4X6PGjMqegeMP+jiFVSufzoLMBacRsut+pVZ Ct1mfiVvcLQQejSw/D+UCmSpvgTMjQZbv5SNC8PA/MwpdGzXs+IUGGY9gChVA9PxuXhf cBt6sJgCvS/o/tUVtpEai7XBQ07H2Q19qE/zb8sP4ozdK/2W3A6ojTNwOMfbvNCokfb0 brug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ApGMDigy; spf=pass (google.com: domain of linux-kernel+bounces-3138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3138-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 m15-20020a1709066d0f00b00a2352b26d10si904721ejr.368.2023.12.18.00.16.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 00:16:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3138-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=ApGMDigy; spf=pass (google.com: domain of linux-kernel+bounces-3138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3138-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 779071F22FD8 for ; Mon, 18 Dec 2023 08:16:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 774AD107A7; Mon, 18 Dec 2023 08:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="ApGMDigy" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 6A8A110780 for ; Mon, 18 Dec 2023 08:15:47 +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-pj1-f44.google.com with SMTP id 98e67ed59e1d1-28b4563a03aso452430a91.0 for ; Mon, 18 Dec 2023 00:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1702887346; x=1703492146; 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=84QetDdy0YwkTJVlaghRjx9Y+piF3q674vdNZK8rIls=; b=ApGMDigyEcl5MMfXZZuLjG0t1wkj9eqxsmEFIhW21ni5R4C8vEZvYyUl8CETsk+dms cqFTtpZkVsTRiMCUZLqk2w5w660RHrvn6gDo8nDVUERl/3LOBQJYO052cTEqndPC/NvZ 5AFJl8PlC/SQGbc4zOeNZ917tJEuxZRDpBYx3mvKPqtO77rTUUu1uMxqsWAVxHKP2tKT UAV5Eh508FkM5p2jF7FChGsvvKsenWnS69Esh6Cx0dFEilxpJDAoG9wahARDl2zi4D6n /XGDSxAHnNjhDcou2fleTLze/rHtoiEsoj/w2819t6YMVZ/AefPZCoVlQJV8ys3rTW10 VPuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702887346; x=1703492146; 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=84QetDdy0YwkTJVlaghRjx9Y+piF3q674vdNZK8rIls=; b=sfZBlYrN6wyd+WO59mnHA+yVWOFlbpIPMf5W8qNWdLpxnk7UmHrmTKfLIDRwAA1wuI UG/b5H0Z0F5Kj58cZU4p0rKliJkEHEQnyP4PgofJeTYHGgq/KSjVDkXLop23xydnWpxL jTBwCv8jw0q/4RLEw7P2yTmGAojk/dLNI2Qe6paTeQ0+txJIP5CYKYG6fN5mxg82QVC4 m81V/bbYL6RmOVyWOtAQZUi0isIHXrt0Ng4/DFtr17EftMf9tHj51ruCnX3xbzmgj9xv Rm3pZj+LKsAHveUS4uYTuizmb1FOZp6oM9dxlaXUuTtibeUmGbfXa9zzd12ej7sNXXaL 3yVg== X-Gm-Message-State: AOJu0Yx4qnvHkok8GhsRa9r3sL91sh2HTdmrfJKC29KkN2UDoKUAN/Cp soRBATRM1FY0Ncs1Kfyr0JWTdg== X-Received: by 2002:a17:90a:f190:b0:28b:6a8a:188 with SMTP id bv16-20020a17090af19000b0028b6a8a0188mr310174pjb.95.1702887346671; Mon, 18 Dec 2023 00:15:46 -0800 (PST) Received: from [10.4.170.32] ([139.177.225.243]) by smtp.gmail.com with ESMTPSA id 16-20020a17090a01d000b0028acb86f7b5sm11995018pjd.44.2023.12.18.00.15.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Dec 2023 00:15:46 -0800 (PST) Message-ID: Date: Mon, 18 Dec 2023 16:15:39 +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 3/5] mm/zswap: refactor out __zswap_load() Content-Language: en-US To: Yosry Ahmed Cc: Andrew Morton , Nhat Pham , Chris Li , Johannes Weiner , Seth Jennings , Dan Streetman , Vitaly Wool , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20231213-zswap-dstmem-v1-0-896763369d04@bytedance.com> <20231213-zswap-dstmem-v1-3-896763369d04@bytedance.com> From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2023/12/14 08:52, Yosry Ahmed wrote: > On Tue, Dec 12, 2023 at 8:18 PM 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. Thanks.