Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1977956rwb; Fri, 11 Nov 2022 03:21:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4H7DETVR0/2Lht1bT3HmL8sxOjm6gKtj231yyDF1q3J2PqDJikCEk/tVsmZV7HIFtziq3Y X-Received: by 2002:a17:903:4cf:b0:185:46a5:1c73 with SMTP id jm15-20020a17090304cf00b0018546a51c73mr1991930plb.157.1668165695951; Fri, 11 Nov 2022 03:21:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668165695; cv=none; d=google.com; s=arc-20160816; b=x0PCvuTsFIY5cxn2xRRZSxBwUx/IKClGaei2bPkVkPsLuW9wQhQg6jbtfCsk+PERfR RpDG+FZrmrYj3gn/JB5scJd8PjM1cXky4JKdg73NcYQcYKzZT1JTr4mU34I7IHgLP8kK /H6rlRrEquAmpz8P+Vn5hguboRuGQ2OMye+dErPqZcTOy2FRv9S2FTL/olBxFQ1bDgQp +DXFfbvht+Ai9x4o84jnFg07rzChbYthAtXLm97Y+ZQI8MHlkFLR2SFfVXJ+l3rjjE7U 1CiY/t/120pld4XGKzykCAXVWKDc+i2zmhbWp9+DHauPI6JDTLSxDBEwlBnUkpqnTIqR LXzQ== 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=fy5PQnQnZm5cRZ5qG1YNPYJdeovnXsDVIy0x21AyY8o=; b=Gp0+XL7uj/57RZ74u/nX4rlseamSsVgwbbVbccTT9jW23Gx+yG9SvJxWHAs8IsECXq 7s+bDYqDWTd6RR+m5igoCbZxwq8n8P8CZ/YemND0VQNkWOCcnnZhR0I6Iqy26oRC5sOP POoQOo6D51hnnXzAouIrvioK8pSTSd2QHiT8bfE71Wj3T7vAdZag1qOSQa3mOKM1X4at 4P8hLxq8F8lZkB5X6V5IOZFxUVcAyD9yi4yoljUlbR0hLVqRBQ3tXJ2YIzSgGcS7cq4/ L2Wq3K4hqXhfrfgJ6E+sZoOUe2b+sV0FVwPf+R5aD5f2PW4/F4VGFe80l/1gbXF2arXc za2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="PH+k/rdg"; 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 o123-20020a634181000000b0046f357face9si2176125pga.356.2022.11.11.03.21.22; Fri, 11 Nov 2022 03:21:35 -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="PH+k/rdg"; 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 S233820AbiKKKc4 (ORCPT + 92 others); Fri, 11 Nov 2022 05:32:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233671AbiKKKcx (ORCPT ); Fri, 11 Nov 2022 05:32:53 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3008D9 for ; Fri, 11 Nov 2022 02:32:49 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id h14so4098398pjv.4 for ; Fri, 11 Nov 2022 02:32:49 -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=fy5PQnQnZm5cRZ5qG1YNPYJdeovnXsDVIy0x21AyY8o=; b=PH+k/rdgrWBzPBRNudaM5JiBpiCBfD1gWgQoB6IYO8qJwTyO9sNuRZ3p9yU+KQ/SoZ FCFRsX4JqsfBpgp8PWYUih886qdD7FM2MZ2DermrWmOwcSl0HxDR/H8h3KNy2S9aRkY9 TlzPYcaX1WHy+mbtF/ee/4QwZnSigSwSiYosU= 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=fy5PQnQnZm5cRZ5qG1YNPYJdeovnXsDVIy0x21AyY8o=; b=31UbfZkATkXOjBDabg0ZfxNlWdfRRv3FBlMy4D9R+2e+LEQ6PkDy/bignXKnAd1ydI VT/+QhkHELbQPEljGJW3PAIq5Hmfdy6WwIOU3/5dRVgzXDacvrI/Uyt7E6Tu25juaEPr HAG9qPV+JmZmO0sLtCqJks3SwfQFztxAig5cgVz02Cwhf9mlkzLZy6mMYpkfPt9IPc5d +iZkBMf6J+23dss5IGx1OKJD4L5GD+haVgz7yY7MIBIGLmt5R+ZCFzu9YcyWITXRM2GM pqwyEMPluhc8cqP5JC9e5jwBtzYKvGJ56lE/JSMef61qcFDu/roHx8hoK6766Yb9Xp9s ZXMw== X-Gm-Message-State: ANoB5pkQEPn8DW8PXc/GN4U/tJDXVj1wnVy4A6DfiQ5PMBjmo6wLE36h u7/8/Y/5K1jCAcQDGFCCJDUonOfdtvB9sg== X-Received: by 2002:a17:90a:73cf:b0:213:7f5:a972 with SMTP id n15-20020a17090a73cf00b0021307f5a972mr1249702pjk.159.1668162769401; Fri, 11 Nov 2022 02:32:49 -0800 (PST) Received: from google.com ([240f:75:7537:3187:8d55:c60d:579d:741c]) by smtp.gmail.com with ESMTPSA id x125-20020a626383000000b00560bb4a57f7sm1287402pfb.179.2022.11.11.02.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 02:32:48 -0800 (PST) Date: Fri, 11 Nov 2022 19:32:44 +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 6/9] zsmalloc: pass limit on pages per-zspage to zs_create_pool() Message-ID: References: <20221031054108.541190-1-senozhatsky@chromium.org> <20221031054108.541190-7-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 18:10), Minchan Kim wrote: > On Mon, Oct 31, 2022 at 02:41:05PM +0900, Sergey Senozhatsky wrote: > > Allow zsmalloc pool owner to specify max number of pages > > per-zspage (during pool creation), so that different pools > > can have different characteristics. > > > > By default we pass ZS_DEFAULT_PAGES_PER_ZSPAGE which is 4 > > (matches the current order 2 zspages limit). > > How could user decide what's the best size for their workload? [..] For starters in a similar manner that I showed during our meeting. They can run tests, gather stats (zsmalloc objects distribution), analyze where most of the objects sit, how things change when we have different cluster configurations, and so on. But more importantly: they need lots of zramX mm_stat data, which is perfectly traceable and collectable during fleet A/B testing: when a number of devices get randomly assigned to different experiments and receive different zspage len configuration, which they feed to zram sysfs knobs during system startup (when init script configures zram). And then look at statistically significant improvements or regressions. This is how things done in ChromeOS and I'm sure in many other places. In this regard, finding best zspage len value is not any different from finding what is the best zram disksize, or what is the best compression algorithm. Exactly same approach - feed different configuration to devices and then analyze the data. Look at mm_stat-s before and after experiment, per device class/type. We can discuss in more details internally. > > static void zs_zpool_destroy(void *pool) > > @@ -2195,6 +2195,7 @@ static int zs_register_shrinker(struct zs_pool *pool) > > /** > > * zs_create_pool - Creates an allocation pool to work from. > > * @name: pool name to be created > > + * @num_pages: maximum number of pages per-zspage > > How about "max_page_chain:"? OK. Do you dislike idea of creating a `struct zs_tunables` which will hold all fields that we can tune? And then zsmalloc users can pass that struct (a pointer to) to zs_create_pool(). There can be various tunables. Like policy changes: do we use static zspool configuration, or a dynamic one and so on. On zram side, we can have a generic sysfs knob: allocator_tuning, which will accept named params, the same way we did it for recomp_algorithm and recompress. echo "tuneable=VAL tunealbe=VAL" > /sys/block/zramX/allocator_tuning