Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1075898rwb; Fri, 18 Nov 2022 12:21:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Wn8J3AGBb5IHTVD/wsK778kIeXp+64jrJWsoOLPeyt3J6H9jYac2aKqZEcuVYiPGc6HCN X-Received: by 2002:a17:902:d34d:b0:188:64b7:e433 with SMTP id l13-20020a170902d34d00b0018864b7e433mr1171893plk.17.1668802902402; Fri, 18 Nov 2022 12:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668802902; cv=none; d=google.com; s=arc-20160816; b=khOFNcayoE+tWy762pjdVbSDrferPCCPffjajjRzYb4vKnSNUs2EY2WBH+qlZj7jKJ PWEp6FQY1FiqairtmUQbIlr8H0oD0nZ/KaJ3gC/2cjPaklGwQFdxTQQxdQTENyq/7tGY MHFhswH+xmbRTzzCltO6fNAtPXRdLBNg7XzmYsrpL1TJicE4SZN+ceCO2Qhevdvc1toY ADvpx5XPZ+/du2dHBW5aRLKuqSXWcoIuvCVb6O6Swinnf9AZWZ+E6LKXqsnPN1OHUmuW 9Ky8699HtW43EwE09LcZaQLPN7V1Sa+UDPudBUYpqDVd012n4tnDdtLh0g5cMtWXThmS nPlg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SnH+UGx6+sixESVz7YWSOh6Sim/QTDifgTL6tzstjgA=; b=LCP7Ck+OjQMdRpMj8L9UF7sHFEQHEJWs3PITfHefRDze+vRUAiMLuu7/+JS6U40N/9 PTtEAiqHesUjSCWhXWFdifGQa2HUgYTCjmEuoTYcLRvLTdv2oqjm7TrYlU4cxpufXxxs K80akMaKhzt4WK6EWxeJgfVd/4tXPATlQbP8jzi9X/YqSYADP63SwlEw9+QXvrwWbiOe mxCMiiC1hn2PQHGij5rGuY6lmisUcyZqG0yAxhmuRyNmQysZX9qCcIr0SMlK/6S4OAC7 B1+3octRiprAZ3/AQipdfXLWBslpsg55LalUscAZ/K75RETRfkwyNYMNLlzDSm05jmok 7OAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=DRWPND7g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a170902d70f00b00176b26d519dsi4042532ply.350.2022.11.18.12.21.31; Fri, 18 Nov 2022 12:21:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=DRWPND7g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbiKRUEs (ORCPT + 90 others); Fri, 18 Nov 2022 15:04:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiKRUEn (ORCPT ); Fri, 18 Nov 2022 15:04:43 -0500 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7B2C2A3 for ; Fri, 18 Nov 2022 12:04:41 -0800 (PST) Received: by mail-qv1-xf35.google.com with SMTP id p8so3418305qvn.5 for ; Fri, 18 Nov 2022 12:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SnH+UGx6+sixESVz7YWSOh6Sim/QTDifgTL6tzstjgA=; b=DRWPND7gokcVicYVOXrukH04arSMoUahVZMMvUuh/RZt1CvnZFSwMWfFrl1QuagkEO 4IjO4oIV1BjTQCV0spRV/0O4t4cHZRBC4h6d0t77WIEXWlzt/p6E7fmbLczkx83ORg+3 9dx+ArTvBbihStU79hog4sLh8bQ5/lblrBt+E8qj9ExOS8QaFauZF7UeflI4msz+RuTE Z7DGKxt3qghkgGm+EznYjml/czTKqLXhCS0pnS/7dNxVWEYAoXqjglKdSOoY4RME3egL NbO6T82tPvXEWS+KmDaKV7mpwcfeer+q6zPQNk6ss8XwL9UaRnIdC/nkeyJA7zB8/NbP 85fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to: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=SnH+UGx6+sixESVz7YWSOh6Sim/QTDifgTL6tzstjgA=; b=nleQ43SD9vVGKglcgDMleusxmEq7gkZs0MZMUuTeYtF9iYbygCWnNOHN8Qu8nofY24 Ez9iNoVDWCOS4KPV5OsWL8Xcz+S6KgjczLNqaEJIEx3BBARJ7c7Unhet5G16I/uqnDzo QzdqaQ6lOqbO+8tid0sx8251oSJLWMkj2Um1sA4pEh6aWmHkqWLhR45eGQAi6d/CwJQM +40l80U2e59iCwIsM25TxnPA80yQcaITRyfgxKvwXi4CoS4diI94ix7JdAYh2KeM7614 yq/t87yaZyAsUIgV3bb7rkU1opV1JrypryoBK1afI084Len5BReiejAuj0lPq61WggIG ZEgA== X-Gm-Message-State: ANoB5pn3oaKHVHn1WFlZqX6czJ39ZrgPkgD82+S06GnwmXUoU9qd012z jGsiWDtez0fotyqgGcRL1ePwkg== X-Received: by 2002:a05:6214:162e:b0:4c6:57f1:3514 with SMTP id e14-20020a056214162e00b004c657f13514mr8140454qvw.87.1668801880681; Fri, 18 Nov 2022 12:04:40 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:bc4]) by smtp.gmail.com with ESMTPSA id d7-20020ac86147000000b003a5c60686b0sm2564105qtm.22.2022.11.18.12.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 12:04:40 -0800 (PST) Date: Fri, 18 Nov 2022 15:05:04 -0500 From: Johannes Weiner To: Minchan Kim Cc: Nhat Pham , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ngupta@vflare.org, senozhatsky@chromium.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com Subject: Re: [PATCH v5 4/6] zsmalloc: Add a LRU to zs_pool to keep track of zspages in LRU order Message-ID: References: <20221118182407.82548-1-nphamcs@gmail.com> <20221118182407.82548-5-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 18, 2022 at 11:32:01AM -0800, Minchan Kim wrote: > On Fri, Nov 18, 2022 at 10:24:05AM -0800, Nhat Pham wrote: > > @@ -1444,6 +1473,11 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) > > > > /* We completely set up zspage so mark them as movable */ > > SetZsPageMovable(pool, zspage); > > +out: > > +#ifdef CONFIG_ZPOOL > > + /* Move the zspage to front of pool's LRU */ > > + move_to_front(pool, zspage); > > +#endif > > spin_unlock(&pool->lock); > > Please move the move_to_front into zs_map_object with ZS_MM_WO with > comment with "why we are doing only for WO case". I replied to the other thread, but I disagree with this request. The WO exception would be as zswap-specific as is the rotate-on-alloc. It doesn't make the resulting zsmalloc code any cleaner or more generic, just weird in a slightly different way. On the other hand, it makes zsmalloc deviate from the other backends and introduces new callchains that invalidate thousands of machine hours of production testing of this code.