Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1957584rdb; Sun, 19 Nov 2023 18:43:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHj80X5piBKfv7YqUmo0H9pPWRC2PEe73xmILX3qrDdKlCJPW0EZwpsKBqWU4j2wY8hFKRL X-Received: by 2002:a05:6a21:6d8f:b0:17b:2c56:70bc with SMTP id wl15-20020a056a216d8f00b0017b2c5670bcmr8449694pzb.10.1700448186143; Sun, 19 Nov 2023 18:43:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700448186; cv=none; d=google.com; s=arc-20160816; b=twuWqj3melIo0pu9UJnwSy74AG4UeGovnfHPXuMRc+MpPKB7Ut6oTXQMnc3Yn4zTOX Mngt5Hr4xTYk70koZFadbuxY8SeBiKarApC/EKNc7rWiuooeQ6BVCfjZlbKTC4c/N4TT f8fOyOP020GYkjPNKsiu3+gJbc0Bye//S0k0T4CqYSB1Y1Lx/AZtygnchta86xaPXXhb koBiX1jPno6A0dblaPoYkBaSNbGpRGy6EnxZRX13/jhWZyVIxU6/dFlnaGEBujJO23Fi q70fVACa3vvWPfqGgabGrE/5oeeF2jGEPbtQIYSYVBvtMICjysY4keLxFMyHUUz4vwe1 ljvA== 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=1OeThoHf3uMeDHt078nnfHlRh9jpmMCwPFIZIn397Jc=; fh=HDENt25GA3417uqjG3CGyIC0cO8FJRUYYcd8tCpA0C0=; b=Vhl7LQpi6aL+N/cycBJIqeoaTH7K+wjlvEhhULdRkzZWoaRPJeKYDpENaE5rWb5LAT yQsu1Oj+0qaBaOnUVb6I4tgsKI4zlvVnw6MnXpCM53aBgtWHVEUP8T1EH96yK9qoL9Pz /YleFQUIzVWTuzfFMUwDQI55ESltCi/hJN7gwHo6fkGo+ZufJOR78qM9krEoyD3F7pU3 XbmoMTaPoUkKGPlGrWErFMV0QW11N0V4yAq6YJ4J3MkI+yveq+0CB7qlM33x8sEC4TqK kwp1eDfyLqigVPikbd6skkb2yk9o8VLG2qqGU9rMkimG+hCkynfO104GgR6VqWN6hKy6 IbZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=N0gJ3Quo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t6-20020a056a0021c600b006910a45a234si7269584pfj.202.2023.11.19.18.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 18:43:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=N0gJ3Quo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 951FF8087268; Sun, 19 Nov 2023 18:42:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231775AbjKTCme (ORCPT + 99 others); Sun, 19 Nov 2023 21:42:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbjKTCmd (ORCPT ); Sun, 19 Nov 2023 21:42:33 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D1B115 for ; Sun, 19 Nov 2023 18:42:28 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50aaaf6e58fso1200690e87.2 for ; Sun, 19 Nov 2023 18:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1700448147; x=1701052947; 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=1OeThoHf3uMeDHt078nnfHlRh9jpmMCwPFIZIn397Jc=; b=N0gJ3QuoNyF6wnF5kK1mdx9nexcs9RMD9oNMnft4upRCP+L3UqPJTMBpkc3z5vVXEN fAThq821YxswDcZylw8SR8B/FV4GoJxxij2Ae+/ZOoJ7NF+6zIIqO/xHqbJvyqrJFrEi KnlqLB3HnFIFT8xkuXqDEaomFkjBDD+5NOBsfohvGu5TDNSq6dMDzJ79mRlBeHUxYPwD +VmbhAJkgMkfVJ3FjpMxhm2nJLAsXeDSgnSgpFi8E4vHa1or/0p6iIM+FL0ZDFynQ4kA DIBtNhUf3xoLDfqw/FW0eMvDZkaUthiLu26q8WrA21FjJugm689+EHUorrroHBQuBd64 1WIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700448147; x=1701052947; 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=1OeThoHf3uMeDHt078nnfHlRh9jpmMCwPFIZIn397Jc=; b=YVHnbA0y2b2yyY9Qq5rUquXwUs9O86/A0q5Jz70pGxWo87Vd9uEhecfKG49Ko0rzRm 3mMFqxJ47Up4NPNjiVfqPuAz5fsyyHnFkRr3BQFUPQT1TCY7tDOFzmnYqACxFjBmshC7 e3dgML0jStxntsL16KRA8Lg09OTRbtk5a9/RCrCmnn2k6kDFAG/lYimPGSXelHNUVcVE 7rg0V5krg0fch9nc9XdMQ9iUUJmqinkyfHAw0pz6JqOByQgBuDkBLso/SqChyB0m9yug RsDKh3xnDBiRuHklXY73UJW0zV/+pvgOtQ676A+LwxdoRD6PAQPrsWn/rPjt8tWuXJ7C QDqg== X-Gm-Message-State: AOJu0YxiOB1QhtFTbTOzrqiL2SnW7yWxWd8+Ww2rILrQejXdjvD/CDqm sPIiybtBj5+7TLsbxFdmOqEXCCXy9eUo8biLLFSDNIaM1+/JYPyycmI= X-Received: by 2002:a05:6512:3b83:b0:50a:a9ec:1897 with SMTP id g3-20020a0565123b8300b0050aa9ec1897mr3482128lfv.35.1700448146995; Sun, 19 Nov 2023 18:42:26 -0800 (PST) MIME-Version: 1.0 References: <20231113130601.3350915-1-hezhongkun.hzk@bytedance.com> In-Reply-To: From: Zhongkun He Date: Mon, 20 Nov 2023 10:42:15 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm:zswap: fix zswap entry reclamation failure in two scenarios To: Nhat Pham Cc: Chris Li , Yosry Ahmed , Andrew Morton , Johannes Weiner , 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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 agentk.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 (agentk.vger.email [0.0.0.0]); Sun, 19 Nov 2023 18:42:42 -0800 (PST) > > Shameless plug: zswap will much less likely hit the limit (global or > cgroup) with the shrinker enabled ;) It will proactively reclaim the > objects way ahead of the limit. Hi Nhat=EF=BC=8Cglad to hear from you. Back to the beginning, the original intention of this patch is to solve the problem that shrink_work() fails to reclaim memory in two situations. The zswap_writeback_entry() will failed for !page_was_allocated because zswap_load will have two copies of the same page in memory (compressed and uncompressed) after faulting in a page from zswap when zswap_exclusive_loads disabled. A simple test: 1): Turn off zswap_exclusive_loads_enabled. 2): Run a read-only program and allocate more memory than the limit, so the limit will be reached and shrinker will fail. > > It comes with its own can of worms, of course - it's unlikely to work > for all workloads in its current form, but perhaps worth experimenting > with/improved upon? >