Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1493233rwb; Thu, 10 Nov 2022 17:32:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7a0l8QxpevpVjS68kEUo2hxVxxBg26mWFYnfEC+N9fSD3aSmcczOF2RtzPIAJjGFIHT7CZ X-Received: by 2002:a17:906:5e4b:b0:782:9b27:94aa with SMTP id b11-20020a1709065e4b00b007829b2794aamr150385eju.542.1668130320992; Thu, 10 Nov 2022 17:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668130320; cv=none; d=google.com; s=arc-20160816; b=wRLqjVFoJ3Jm7bnIVRDu+5/YbeLrT4uqAzYtYscKHOAfm92oe6S0B54yznTzEGCn7a 13u+WSXAkfMIDxDvAKeZZCjrngZPZtUh08wO5Fr1ymnhFRKgiKcmOFzOGhyxfc7QmVXt EaAeKxThW6ViM3CaR1abZFiPePldk2ie4FObqAtxeyeGJd955w1v2CjD2wcn+M3Kiolh p5PmVhMVTdKC75PPfWlAdWB7dhJRQ8JSmPEQD6Yd27B82OqLgyJ471+cEkVBCB6srfIe 5Cs03Gy2Mm9drJtgR7YAjBCzlHxj2W3NTKCp63V9acImX3TVMK1tw9H/c3cojod2ZssH hY7Q== 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=rA3+wKh3EdaWBw0rOv2qo0sGAH/sOd4ZXXqLc1LTopw=; b=ppn44iCGgjVDno7FhpwJzYq3x1G19aDJkH/B6L3DkctPRTzzppSYVlpEGIJYFfqhsB OLWkbYQpCX8OI/r/SiTUq6nCNWR1068bagd2K24mfc25sElCvMtRMASAjJY9etpniaF8 KN6hIZiNTaDJ5Hzh865nH6b9LRtj0k4TKXJL+hkiUy2DsQhiQNC30jS6v76nCi2a4PIv mAVQ63UKcYe3vwM5DeMPHhjPEDuGrUMW1GDsCenK52Ql9Zfe3w8SrNYrDf2Jvo/eORpz oz6MN5iqfzePctp1s3PL9S2wCQvEhUdUbT4rdsGc4GztFlMRAX5VBV6ebL5naAc2WpMk hLbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DdFDHSzg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a50c242000000b0046721c5b7e0si904415edf.511.2022.11.10.17.31.38; Thu, 10 Nov 2022 17:32:00 -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=@chromium.org header.s=google header.b=DdFDHSzg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231817AbiKKBHR (ORCPT + 92 others); Thu, 10 Nov 2022 20:07:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiKKBHM (ORCPT ); Thu, 10 Nov 2022 20:07:12 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86E2C4D5FB for ; Thu, 10 Nov 2022 17:07:11 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id k22so3600834pfd.3 for ; Thu, 10 Nov 2022 17:07:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=rA3+wKh3EdaWBw0rOv2qo0sGAH/sOd4ZXXqLc1LTopw=; b=DdFDHSzgzBO799XV6cwlfQyrsaUFQfKLoyLDeFNweuqt4Qrtb+nc8ghCYTIrkx/j2P PnzLO06BBVEQgEwvdzD2TWOVP2yAuC7LAtuAm6VSnPPfaK8QxytA7yv0OhxbCpBs9smZ wsyMLwblWLdjNNrI3iGJim6hgHcwgAX0vCVYA= 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=rA3+wKh3EdaWBw0rOv2qo0sGAH/sOd4ZXXqLc1LTopw=; b=I+8yxJ33I5Mh4QoXNbCpqLInpsU6+G1Iwk+hgZBfdjmyo6Q3ilDsun/ghfNUFKteCl pkVZYbFLk43EjXGRK9gYee7V7cXU3LrhYu00KIU2Z61tBv7GuQI5cwdKwyT33XP5mL2M RP3KQThJmDrcwqOYoi9UEjzSbD+MEy1QEJ2h+UXOKEzUWytzVhmGfpflYK3vVl/NkZey nYf5vpd3j7OKJnZqrg5ERJrwjn+IHnGaqmZzwQdRI0fLWCK2qy1wf7ilUNBjhiawqM5Z FWEMkyJZozPYPXf22HnMOctuVH3gsOl92WosY4Tizz+fZmXcZOrGI1KvWXrCC3fimYEb Ytig== X-Gm-Message-State: ANoB5pnNDb2UGrAsSME6eRCpVMSTsUqCPoSQb71iBCiBLw9nlL3YJ3FA pbD4CREcrfGaYY7WF5lEvR0KD9aTyRuqJA== X-Received: by 2002:aa7:8092:0:b0:56d:8145:3faa with SMTP id v18-20020aa78092000000b0056d81453faamr94514pff.75.1668128831068; Thu, 10 Nov 2022 17:07:11 -0800 (PST) Received: from google.com ([240f:75:7537:3187:8d55:c60d:579d:741c]) by smtp.gmail.com with ESMTPSA id nn14-20020a17090b38ce00b00213d28a6dedsm3709254pjb.13.2022.11.10.17.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 17:07:10 -0800 (PST) Date: Fri, 11 Nov 2022 10:07:06 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Andrew Morton , Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv4 4/9] zsmalloc: make huge class watermark zs_pool member Message-ID: References: <20221031054108.541190-1-senozhatsky@chromium.org> <20221031054108.541190-5-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 (22/11/10 14:25), Minchan Kim wrote: > On Mon, Oct 31, 2022 at 02:41:03PM +0900, Sergey Senozhatsky wrote: > > We will permit per-pool configuration of pages per-zspage value, > > which changes characteristics of the classes and moves around > > huge class size watermark. Thus huge class size needs to be > > a per-pool variable. > > I think part of code in previous patch should move here since > you are creating the feature in this patch: What do you mean? This patch - make huge_class_size a pool value - looks completely independent to me. > BTW, I am wondering we really need to jump the per-pool config > option over global general golden ratio and/or smarter approach > to optimize transparently depending on how much memory we have > wasted. I like the per-zspool value. Dynamic zspage sizing is going to be very very difficult if possible at all. With different zspage limits we create different size class clusters and we also limit huge size class watermark. So if we say, increase the zspage length value, then we have more size classes: but in order for us to actually start saving memory we need to move objects that waste memory in previous cluster configuration to new classes. It's even more complex with huge objects. When we say move huge size class watermark from 3264 to 3632 then in order to actually save memory we need to recompress huge objects and put them into size classes that are between 3264 and 3632. And that's only half. We also can lower the zspage length limit and we'll have less size classes (because they merge more) and move huge size class watermark from 3632 back to 3264. How do we handle this? I really think that per-zspool knob is the easiest way. And it doesn't block us from doing any improvements in the future.