Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3348381ybg; Fri, 25 Oct 2019 02:49:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2ittCP6WHTynonusn+1uPctN34gmBH85LMSrhLShAHpapAiMW7t2j02I42R1rM/gjF2uc X-Received: by 2002:a17:906:9391:: with SMTP id l17mr2472411ejx.315.1571996979289; Fri, 25 Oct 2019 02:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571996979; cv=none; d=google.com; s=arc-20160816; b=U9YfH7M3h3Wr/zjnqnTI1bmP4cemj1a5ap0sI0AB/yihrcV0/hI3XtAnm9DAL+rTPm LQp66zN1f/X7x5zE98EeY0gVbb7UAKtXaNveozKmR7Vz++7wmrBIummUKaVB33ckJ9iA 1LV5tJpC/VixGui4RElKcwicdlK38k/4+RGzuiOJs0Rfjlkx2CsZukrctGvSe1/BFjms FV/WbfYg/QcAr3RlREi59hEpm5iIKO5afiI1U5Nzfn6Wr/QpsxV7U3y1vmTHQ9zonQum Pll7ziJlOysMThsVlQpADKQpzAzKUzS/FxGqNQyj8Z0Q//5twHuuUxHlroeDT9TUsPnt rW0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=pZDudQLOdmuQicShCoZbjYBWhG8towc7KxqfJTbfAnA=; b=l8JdegmJg6d1g0petb+NwYygWG1kkBLMEurCnyPq9A6BTFXXsiYNqdP59bDbYUNjuG fsKPiIxR7CKS9qqoruP/wg+8meX9Ca15vV240jf4Asuf0PedYqP7WepKbd5CAFxceyPq IATUc++OvS1bjueq+ggV8CDqU+oTdrjW3agWNGOtLnH6aLTBUah1e36VCQU6zsxJqRiH SzkODgurDAyyme6/SHLWor8eJSTubvbjwN9cRl8khX5dpoMATmPmUgPzw+s/IjO7VqTL twrMseAqHh3pqYR34B0rdacf/vI/iSkM40TcH+PuemdTK/2ky6w2Jg8uhZEc8GYSpDTQ pwTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si935274edi.252.2019.10.25.02.49.15; Fri, 25 Oct 2019 02:49:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405242AbfJXLEK (ORCPT + 99 others); Thu, 24 Oct 2019 07:04:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:36606 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2393393AbfJXLEK (ORCPT ); Thu, 24 Oct 2019 07:04:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 498ECB1A1; Thu, 24 Oct 2019 11:04:08 +0000 (UTC) Subject: Re: [PATCH v2] zswap: allow setting default status, compressor and allocator in Kconfig To: "Maciej S. Szmigiero" , Seth Jennings , Dan Streetman Cc: Vitaly Wool , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20191023232209.3016231-1-mail@maciej.szmigiero.name> From: Vlastimil Babka Autocrypt: addr=vbabka@suse.cz; prefer-encrypt=mutual; keydata= mQINBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB KxRWDHX0R2tgpFDXHnzZcQyw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diNAbJWZ F5GNUS2/2IbgOhOychHdqYpWTqyLgRpf+atqkmpIJwFRVhQUfwztuybgJLGJ6vmh/LyNMRr8 J++SqkpOFMwJA81kpjuGR7moSrUIGTbDGFfjxmskQV/W/c25Xc6KaCwXah3OJ40AEQEAAYkC PAQYAQoAJhYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJbGTU1AhsMBQkDwmcAAAoJECJPp+fM gqZkPN4P/Ra4NbETHRj5/fM1fjtngt4dKeX/6McUPDIRuc58B6FuCQxtk7sX3ELs+1+w3eSV rHI5cOFRSdgw/iKwwBix8D4Qq0cnympZ622KJL2wpTPRLlNaFLoe5PkoORAjVxLGplvQIlhg miljQ3R63ty3+MZfkSVsYITlVkYlHaSwP2t8g7yTVa+q8ZAx0NT9uGWc/1Sg8j/uoPGrctml hFNGBTYyPq6mGW9jqaQ8en3ZmmJyw3CHwxZ5FZQ5qc55xgshKiy8jEtxh+dgB9d8zE/S/UGI E99N/q+kEKSgSMQMJ/CYPHQJVTi4YHh1yq/qTkHRX+ortrF5VEeDJDv+SljNStIxUdroPD29 2ijoaMFTAU+uBtE14UP5F+LWdmRdEGS1Ah1NwooL27uAFllTDQxDhg/+LJ/TqB8ZuidOIy1B xVKRSg3I2m+DUTVqBy7Lixo73hnW69kSjtqCeamY/NSu6LNP+b0wAOKhwz9hBEwEHLp05+mj 5ZFJyfGsOiNUcMoO/17FO4EBxSDP3FDLllpuzlFD7SXkfJaMWYmXIlO0jLzdfwfcnDzBbPwO hBM8hvtsyq8lq8vJOxv6XD6xcTtj5Az8t2JjdUX6SF9hxJpwhBU0wrCoGDkWp4Bbv6jnF7zP Nzftr4l8RuJoywDIiJpdaNpSlXKpj/K6KrnyAI/joYc7 Message-ID: Date: Thu, 24 Oct 2019 13:04:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20191023232209.3016231-1-mail@maciej.szmigiero.name> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/24/19 1:22 AM, Maciej S. Szmigiero wrote: > The compressed cache for swap pages (zswap) currently needs from 1 to 3 > extra kernel command line parameters in order to make it work: it has to be > enabled by adding a "zswap.enabled=1" command line parameter and if one > wants a different compressor or pool allocator than the default lzo / zbud > combination then these choices also need to be specified on the kernel > command line in additional parameters. > > Using a different compressor and allocator for zswap is actually pretty > common as guides often recommend using the lz4 / z3fold pair instead of > the default one. > In such case it is also necessary to remember to enable the appropriate > compression algorithm and pool allocator in the kernel config manually. > > Let's avoid the need for adding these kernel command line parameters and > automatically pull in the dependencies for the selected compressor > algorithm and pool allocator by adding an appropriate default switches to > Kconfig. > > The default values for these options match what the code was using > previously as its defaults. > > Signed-off-by: Maciej S. Szmigiero > --- > Changes from v1: > Rename CONFIG_ZSWAP_DEFAULT_COMP_* to CONFIG_ZSWAP_COMPRESSOR_DEFAULT_* > and CONFIG_ZSWAP_DEFAULT_ZPOOL_* to CONFIG_ZSWAP_ZPOOL_DEFAULT_* while > dropping the "_NAME" suffix from the final string option in both cases. > > mm/Kconfig | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++- > mm/zswap.c | 26 ++++++++------ > 2 files changed, 117 insertions(+), 12 deletions(-) > > diff --git a/mm/Kconfig b/mm/Kconfig > index a5dae9a7eb51..267316941324 100644 > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -525,7 +525,6 @@ config MEM_SOFT_DIRTY > config ZSWAP > bool "Compressed cache for swap pages (EXPERIMENTAL)" > depends on FRONTSWAP && CRYPTO=y > - select CRYPTO_LZO > select ZPOOL > help > A lightweight compressed cache for swap pages. It takes > @@ -541,6 +540,108 @@ config ZSWAP > they have not be fully explored on the large set of potential > configurations and workloads that exist. > > +choice > + prompt "Compressed cache for swap pages default compressor" > + depends on ZSWAP > + default ZSWAP_COMPRESSOR_DEFAULT_LZO > + help > + Selects the default compression algorithm for the compressed cache > + for swap pages. > + If in doubt, select 'LZO'. Could it e.g. suggest which one is the fastest and which most space efficient? Also does this cover all compression algorithms? Are we going to add new options if there are new ones? Wouldn't a string instead of choice be sufficient here? > + > +choice > + prompt "Compressed cache for swap pages default allocator" > + depends on ZSWAP > + default ZSWAP_ZPOOL_DEFAULT_ZBUD > + help > + Selects the default allocator for the compressed cache for > + swap pages. > + The default is 'zbud' for compatibility, however please do > + read the description of each of the allocators below before > + making a right choice. It's somewhat unfortunate that the choice options don't include the description and one has to go look for it elsewhere. Also, shouldn't the list include zsmalloc? > + The selection made here can be overridden by using the kernel > + command line 'zswap.zpool=' option. > + > +config ZSWAP_ZPOOL_DEFAULT_ZBUD > + bool "zbud" > + select ZBUD > + help > + Use the zbud allocator as the default allocator. > + > +config ZSWAP_ZPOOL_DEFAULT_Z3FOLD > + bool "z3fold" > + select Z3FOLD > + help > + Use the z3fold allocator as the default allocator. > +endchoice > + > +config ZSWAP_ZPOOL_DEFAULT > + string > + default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD > + default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD > + default "" > + > +config ZSWAP_DEFAULT_ON > + bool "Enable the compressed cache for swap pages by default" > + depends on ZSWAP > + help > + If selected, the compressed cache for swap pages will be enabled > + at boot, otherwise it will be disabled. > + > + The selection made here can be overridden by using the kernel > + command line 'zswap.enabled=' option. > + > config ZPOOL > tristate "Common API for compressed memory storage" > help > diff --git a/mm/zswap.c b/mm/zswap.c > index 46a322316e52..71795b6f5b71 100644 > --- a/mm/zswap.c