Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp872031rdb; Fri, 17 Nov 2023 15:48:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmAaxKa/UEPe6XITxLFbxI0lSeE7/PXegUMpjfQvbfGMArM7M/hwrG/kTvGsYTsA1wKCD5 X-Received: by 2002:a05:6808:2018:b0:3b6:cadf:be06 with SMTP id q24-20020a056808201800b003b6cadfbe06mr1376091oiw.23.1700264894921; Fri, 17 Nov 2023 15:48:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700264894; cv=none; d=google.com; s=arc-20160816; b=zaVzrjY1umOtwW0HC9BveFa2AicY/qjz/6zuBxwlWB7cIQ2pBHJRaycArwz2pEbdYI woVWyTp+RhTfgCxoKylRA4gX+TX7cBIIZ+gwTQytYkWL6Ns0jkkt/efCmFgsIVOOVWz2 eSjEPB/5ayWUDd/ORl3dn4Mm5Kgyx5/wkm1HUrCyYS7QG6ckVgGBmv0y581ivH31ZOJt zzlCFmKu7U+uJ7FyTnlVgZAKvxTqJEkLbcxRITl0O9i/o90kQEjlLBY55mj7nlBl4U/B L/bSvoBWUxxKjQMKnm9Gz+MgSFEF46r2jbKBMrMcjQKAX/0RJFnhEexzj8YUA6p18CXd JtVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dg1awzAqw4mpKRGPL+cAYrtUk9f0swhurzhbbxoaSIQ=; fh=sRVozG699yxGhEfTTlgokEZDcURq4BK+eGYnTInTOnY=; b=FZ5DpBEx6HuMemgFvof9mCgDbFCuQos3nIG2SgkhXaztTN+DFQMH/l4Hmkobr6Uvd2 omx/QzIwImp6BUjE2fXjZgFbrf6NHzz35XkHSftrNoFzxIotLp2Oq7AQITjL424fGAi4 n954/NNJGAoDiAFNJMuzdbfqJZoGDP2dHh1x2wUopMWLobnd8L7jwkp9spRXTSApFEkH 714V2+H0IehjCkFcYORUv3ZihRiWRsZCkr2kmxgG/YUkEY8kADAvRecZLLCY9Fe5vLUd F0v31twiP3QayM2QlAXC8gaGVq9sFUI0zwg97gJR53kILXy6nGgH8qu2/I8z8I3Awg1u 58nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJZwIlBg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id u3-20020a634703000000b005be1ee5be37si2822438pga.133.2023.11.17.15.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 15:48:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJZwIlBg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7FDBE837D955; Fri, 17 Nov 2023 15:48:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346284AbjKQXsF (ORCPT + 99 others); Fri, 17 Nov 2023 18:48:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbjKQXsE (ORCPT ); Fri, 17 Nov 2023 18:48:04 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE836131 for ; Fri, 17 Nov 2023 15:48:01 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52D34C433CA for ; Fri, 17 Nov 2023 23:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700264881; bh=3VDvuRLZKeYSFlqVGWpz4nQo8YGybjGYmZp/AoQF7ZQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=BJZwIlBgytB1VjMr4ot28kbKARhgLJ5qblFXXO3MPvCjNfJ6eMZwi1uir6c7i2n0l 2gI3j3LZXyuKLAjQPMnH+XB3lI72BjlhW43fo6W4BM8i5MB/eyH3jJDTB37epeC/et 0L37xgsckYnn6i4ciYOowmT7SzPxY7hWzXJVeZcRkKqpabodmtnD2giHauq4dSmkoe AYLMkLRqFo5JpLitRxt3gjs8YsWBkh3pKFQ2FuN4pAhbQzBst0k0GiY/WtU7VlJZ3Y 0cvllACAjxXqJy1a844fTVuGkbnQX1X2Kvj5XMsvzdH28n74KeNRuei4bt/6pusk4m F8sdRwu7xqG/g== Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5b8f68ba4e5so1940832a12.1 for ; Fri, 17 Nov 2023 15:48:01 -0800 (PST) X-Gm-Message-State: AOJu0Yyhm1r824zs+Fv46A5gNbCisf73VJIuf1P4rE4slIRZlOsEaQRQ e1NHE4+STfrR/bBJSyMbZXGhOGYfF0vTJcR6gnfqJg== X-Received: by 2002:a05:6a20:3944:b0:155:5c28:ea74 with SMTP id r4-20020a056a20394400b001555c28ea74mr681946pzg.12.1700264880792; Fri, 17 Nov 2023 15:48:00 -0800 (PST) MIME-Version: 1.0 References: <20231113130601.3350915-1-hezhongkun.hzk@bytedance.com> In-Reply-To: From: Chris Li Date: Fri, 17 Nov 2023 15:47:49 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [External] Re: [PATCH] mm:zswap: fix zswap entry reclamation failure in two scenarios To: Zhongkun He Cc: Yosry Ahmed , Andrew Morton , Johannes Weiner , Nhat Pham , Seth Jennings , Dan Streetman , Vitaly Wool , linux-mm , LKML , Ying Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 15:48:12 -0800 (PST) On Fri, Nov 17, 2023 at 1:56=E2=80=AFAM Zhongkun He wrote: > Hi Chris, thanks for your feedback. I have the same concerns, > maybe we should just move the zswap_invalidate() out of batches, > as Yosry mentioned above. As I replied in the previous email, I just want to understand the other side effects of the change better. To me, this patching is actually freeing the memory that does not require actual page IO write from zswap. Which means the memory is from some kind of cache. It would be interesting if we can not complicate the write back path further. Instead, we can drop those memories from the different cache if needed. I assume those caches are doing something useful in the common case. If not, we should have a patch to remove these caches instead. Not sure how big a mess it will be to implement separate the write and drop caches. While you are here, I have some questions for you. Can you help me understand how much memory you can free from this patch? For example, are we talking about a few pages or a few GB? Where does the freed memory come from? If the memory comes from zswap entry struct. Due to the slab allocator fragmentation. It would take a lot of zswap entries to have meaningful memory reclaimed from the slab allocator. If the memory comes from the swap cached pages, that would be much more meaningful. But that is not what this patch is doing, right? Chris