Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp346088rdg; Thu, 12 Oct 2023 07:22:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcN6qeF2v8EplV6jV08MoR6vL+YZQedTka4OGD96BlDjmsxvR6Cq5Cwohysy8CROsHvu4Y X-Received: by 2002:a05:6a20:7487:b0:15d:3a10:18c6 with SMTP id p7-20020a056a20748700b0015d3a1018c6mr24827011pzd.45.1697120545763; Thu, 12 Oct 2023 07:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697120545; cv=none; d=google.com; s=arc-20160816; b=eT70DFUwJ7aM6d6FIDmM8OfKj5Iaz2ybYYsaF8Y/Dpu+NMIXvhEUSGicEC/CnNJ78n 7RoWF0ibtMaPuT6x1yqemgzmzw/lHdl/fmv1UNPLYUxAqePTEZj93R4uAfSucOKsjEah 1K109GFUta3Z+bM11I7aB+0BoJR7KRRHPWWXpRrGqZr0j7/ix34VXYXjYzQgr3aIB/d8 wGrwWX7DvhpHlIcahEzKc7CBtV9aO5Nu9AQxCtLRd0V1z7WNLOCWcEd/n6/0w5JZSgng L5ukMhRtYa370js+jxHEIGKX4NPOEwC8eT32cI3/rCY18fE/DEiHjOcpQgthFyeArFJv 2r7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7BE2R8PIkyHRd4gL99LO+dIQVqA8MQjkYJ3iaAbvj+E=; fh=p4wY5JRqbn3swHrZM2bjPUjCmDJWl6Ly0XGg1HSL0aA=; b=Ulf8VlQI88KeDWzK468eDSbWFi76VUnYLubTKZ68905DY/LHg7Vm4L84qo7NL2Aci7 hlbdchrTIiiLaPc5T/zFYQLWIYb+SrBCYDfdTZCJRr8TljM+F/eLrRWEmZdeSiAuJXEu dV8grzXUgsHXVDHciTXPiimd2ZS57uA+2820b1U+R4BtL3wcn53XGAjudHG4PsCLur8D blHB2fQNvAdO3N/fEaPVJv3E3i2A2udFSx+nk8yk458l1M52RdDLbDgqjNKzS+4UkyrE fq5VqsDnOnxeDK4khMQatLiNHO02yKC2bqrowLNAK2/stqTUMiDEfj5GVUOrl7xmoYty jvGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=P2LofO0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l131-20020a633e89000000b005740d553e73si2230480pga.114.2023.10.12.07.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 07:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=P2LofO0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 221708260085; Thu, 12 Oct 2023 07:22:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347262AbjJLOWJ (ORCPT + 99 others); Thu, 12 Oct 2023 10:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235194AbjJLOWH (ORCPT ); Thu, 12 Oct 2023 10:22:07 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2543BB for ; Thu, 12 Oct 2023 07:22:05 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-65b162328edso5395566d6.2 for ; Thu, 12 Oct 2023 07:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1697120525; x=1697725325; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=7BE2R8PIkyHRd4gL99LO+dIQVqA8MQjkYJ3iaAbvj+E=; b=P2LofO0wg0MZJpWNnTO8gBnfhAMOcMZwJ7QCx/X93aG2chXeovab2DfZbuR0geyR5Y G8AgC9aZnhOWI3ZeLwL0kt3baw7imBiDa7b3dDRSWP6MrSpn8Yvnco2tam8faOvc3PWC k+/2qkZ/y9zoAZd1BQ95HZqPOmBuAq2UKLZoV4PiTq7ZpxdB3apQCTmy0uYbSMdSQIyQ 6dBGZauKXqDFqPOSoCdgScdBpmer2ez1I0Co4zZj7Jcf3BBvb/8qB3UmZzsoeHnmy/PG 5/twEmQKlkeb41xGcTWg7+aavIs2sLe8l77fmCKGOA0evFQoGcUyy4Pj1zEvm4T0IF+3 bP3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697120525; x=1697725325; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7BE2R8PIkyHRd4gL99LO+dIQVqA8MQjkYJ3iaAbvj+E=; b=lrIwm1yF4a8vibfxAuwhvVO9Wrti+LXj4oTfJPx0NY9PWnmoTMjJATtj2xG2ZF24UK f+8rZIumU2NQUej6uMn8UJIYDD/ilSzMHr0uNZv/eU1TOaXmpEnFvPPMzlfpSPCX+ETM 7h7+ObCJP4AApCpqqXqMLRsxYbSY5bs5eHqzjrZ7ss8TF/z9w2+ZFw0EGKY/wQ7wd7rP lTq0Dh53rS6/UP/XQGHa0u0/uHXxBp9ODVOY9ioJbBzgBwF0jZptkagxb981YKLvBW8t Ohc/6iAqo5Z1t4vUQrkfcbUSwEyt6ek5IdW80rUrUnDEmNy5i6g1vE1MEiQAMirJIoMn GHiw== X-Gm-Message-State: AOJu0YyCQxIHWqhDSPZOumyGZqi91/rQIl0AZ1qj+M4J/ar/aPQIRGVB vJsjBfaP1E5lJREDF3S3rvhlwA== X-Received: by 2002:a05:6214:300e:b0:66d:12e0:2555 with SMTP id ke14-20020a056214300e00b0066d12e02555mr3239901qvb.33.1697120524914; Thu, 12 Oct 2023 07:22:04 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:66a6]) by smtp.gmail.com with ESMTPSA id jy20-20020a0562142b5400b0065d05c8bb5dsm464815qvb.64.2023.10.12.07.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 07:22:04 -0700 (PDT) Date: Thu, 12 Oct 2023 10:22:03 -0400 From: Johannes Weiner To: =?utf-8?B?6LS65Lit5Z2k?= Cc: Nhat Pham , akpm@linux-foundation.org, yosryahmed@google.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [External] Re: [RFC PATCH] zswap: add writeback_time_threshold interface to shrink zswap pool Message-ID: <20231012142203.GB470544@cmpxchg.org> References: <20231011051117.2289518-1-hezhongkun.hzk@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 07:22:23 -0700 (PDT) On Thu, Oct 12, 2023 at 10:13:16PM +0800, 贺中坤 wrote: > Hi Nhat, thanks for your detailed reply. > > > We're currently trying to solve this exact problem. Our approach is to > > add a shrinker that automatically shrinks the size of the zswap pool: > > > > https://lore.kernel.org/lkml/20230919171447.2712746-1-nphamcs@gmail.com/ > > > > It is triggered on memory-pressure, and can perform reclaim in a > > workload-specific manner. > > > > I'm currently working on v3 of this patch series, but in the meantime, > > could you take a look and see if it will address your issues as well? > > > > Comments and suggestions are always welcome, of course :) > > > > Thanks, I've seen both patches. But we hope to be able to reclaim memory > in advance, regardless of memory pressure, like memory.reclaim in memcg, > so we can offload memory in different tiers. Can you use memory.reclaim itself for that? With Nhat's shrinker, it should move the whole pipeline (LRU -> zswap -> swap). > Thanks for your review,we should update the store time when it was loaded. > But it confused me, there are two copies of the same page in memory > (compressed and uncompressed) after faulting in a page from zswap if > 'zswap_exclusive_loads_enabled' was disabled. I didn't notice any difference > when turning that option on or off because the frontswap_ops has been removed > and there is no frontswap_map anymore. Sorry, am I missing something? In many instances, swapins already free the swap slot through the generic swap code (see should_try_to_free_swap()). It matters for shared pages, or for swapcaching read-only data when swap isn't full - it could be that isn't the case in your tests.