Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2602946ybj; Mon, 23 Sep 2019 06:34:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwz7xnbdy3l/9G/4G13oK0Ao2PhimUVzfRGk6D+SZUJBXOXMfJXUQYUGRSbonRMlYuUlxZt X-Received: by 2002:a50:87ca:: with SMTP id 10mr20196edz.77.1569245675456; Mon, 23 Sep 2019 06:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569245675; cv=none; d=google.com; s=arc-20160816; b=cpv0iGs+RNUKNyjWQqB3Qm3bzzEO2ykabBYdhrT40ib81hFdLdYiJ3c19RbeAHaQ9T aj9pD0f8q5CsOPA3yYEonxuq2Qbr7syDQ6HWdGNbpWY5iE7v8Hn2M9yR8gwKTOnxa3sJ Xf+z9bVZ9PqZIV6fguG2P50I/NseTm7RTHu43peQkC4MNQpSpJeOP5vmzFXE3OFjfhnZ 0RAkrdeaQBDGb3a28SmbmyUs5xvDXS22+Sgfd7o1IwPiZBLM9lcDjFrmmQfdOoP8ALt7 pEInS1kN+G31O22kkvkzFL0lgCpgxlFqB/p15jA8Y0/2cl2a6sJOtp8rggQ0WYJmDkRN B5EQ== 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:from:references:to:subject:dkim-signature; bh=4PchiSSViLW0r0Wt7nbJES5Bs28WkfeH74BkpFQR7sc=; b=lTXscKuPvhfV/4s8S3+GjiXUZAfGJYGa9jsZz/z0bkBYZUZAd/1Npf3ZowOBgWWnXv w0e/zafNJhlieMtgzPRPt2t2vwoCIWjGK3qV+dxD5SMWpweqw4mMKnIJBcEonb0IrJOs PZUQ/9SGAx2sXbgmE9dZUkgsK9BnQ4nlbNPpEmUExKz9kZMytHli0mgPYfT9q1lad/A4 0AIMvgMRFXdEVjIrnLP/nmgqHGle/+5SvuVJZhroaSEVI/x5RQzDg67KZNiRGpPxsW0J Kxc0V1A96LQ549YakSa38GcBmeb1sXe0QOIsooM2fkB9P1/XRYS85C9OZ8MuaRbeuJ6J BQ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hhdDkdje; 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 g31si6413563eda.399.2019.09.23.06.34.12; Mon, 23 Sep 2019 06:34:35 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=hhdDkdje; 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 S2407385AbfIUAWs (ORCPT + 99 others); Fri, 20 Sep 2019 20:22:48 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48722 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405111AbfIUAWs (ORCPT ); Fri, 20 Sep 2019 20:22:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4PchiSSViLW0r0Wt7nbJES5Bs28WkfeH74BkpFQR7sc=; b=hhdDkdje1aiOmtMCxZAD0kSz+ /p3p3wKvpUQ4U/Ug5RGlBwHwUeM8tXo40vjPS0di+woN2Nm6GDe0LDI+SFGd6yhGS986KctAxVui1 dQQvhrm/dV6Wfq86S4yEh5OIXsmcg2bXJIu1UDKsmHj3+KTqEvMVmorqTjouGt7oRY0asF/piWpYg ZtLoQT4kcSsdO356zvaY+P6V+hHtGXOzkiEMAxVTI0D9/cHLM6r12Gy9ILuNOLhWwfxSIWpf/pbMT DA4qBn9AI6siLgmKHz3SOH5ij2J3sZqAt2d+Qi5jvhy8HlJPl9uLOumQu1cj4pqYo5DnlkyNJSLOR u4jJe5BXw==; Received: from [2601:1c0:6280:3f0::9a1f] by bombadil.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iBTAf-0007TQ-QH; Sat, 21 Sep 2019 00:22:41 +0000 Subject: Re: [RFC v2] zswap: Add CONFIG_ZSWAP_IO_SWITCH to handle swap IO issue To: Hui Zhu , sjenning@redhat.com, ddstreet@ieee.org, akpm@linux-foundation.org, mhocko@suse.com, willy@infradead.org, chris@chris-wilson.co.uk, hannes@cmpxchg.org, ziqian.lzq@antfin.com, osandov@fb.com, ying.huang@intel.com, aryabinin@virtuozzo.com, vovoy@chromium.org, richard.weiyang@gmail.com, jgg@ziepe.ca, dan.j.williams@intel.com, rppt@linux.ibm.com, jglisse@redhat.com, b.zolnierkie@samsung.com, axboe@kernel.dk, dennis@kernel.org, josef@toxicpanda.com, tj@kernel.org, oleg@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <1568961307-32419-1-git-send-email-teawaterz@linux.alibaba.com> From: Randy Dunlap Message-ID: Date: Fri, 20 Sep 2019 17:22:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1568961307-32419-1-git-send-email-teawaterz@linux.alibaba.com> 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 9/19/19 11:35 PM, Hui Zhu wrote: > This is the second version of this patch. The previous version is in > https://lkml.org/lkml/2019/9/11/935 > I updated the commit introduction and Kconfig because it is not clear. > Hi, Just a few minor fixes (below): > > Signed-off-by: Hui Zhu > --- > include/linux/swap.h | 3 +++ > mm/Kconfig | 18 +++++++++++++++++ > mm/page_io.c | 16 +++++++++++++++ > mm/zswap.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 92 insertions(+) > > diff --git a/mm/Kconfig b/mm/Kconfig > index 56cec63..5408d65 100644 > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -546,6 +546,24 @@ config ZSWAP > they have not be fully explored on the large set of potential > configurations and workloads that exist. > > +config ZSWAP_IO_SWITCH > + bool "Compressed cache for swap pages according to the IO status" > + depends on ZSWAP > + def_bool n Just drop the "def_bool n". It's already a "bool" and 'n' is the default value for it. > + help > + This function help the system that normal swap speed is higher helps the system in which normal swap speed is higher > + than zswap speed to handle the swap IO issue. > + For example, a VM that is disk device is not set cache config or possibly: For example, a VM where the disk device is not set for cache config or > + set cache=writeback. > + > + This function make zswap just work when the disk of the swap file This function makes > + is under high IO load. > + It add two parameters read_in_flight_limit and write_in_flight_limit to It adds two parameters (read_in_flight_limit and write_in_flight_limit) to > + zswap. When zswap is enabled, pages will be stored to zswap only > + when the IO in flight number of swap device is bigger than of the swap device > + zswap_read_in_flight_limit or zswap_write_in_flight_limit. > + If unsure, say "n". > + > config ZPOOL > tristate "Common API for compressed memory storage" > help > diff --git a/mm/zswap.c b/mm/zswap.c > index 0e22744..1255645 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -62,6 +62,13 @@ static u64 zswap_reject_compress_poor; > static u64 zswap_reject_alloc_fail; > /* Store failed because the entry metadata could not be allocated (rare) */ > static u64 zswap_reject_kmemcache_fail; > +#ifdef CONFIG_ZSWAP_IO_SWITCH > +/* Store failed because zswap_read_in_flight_limit or > + * zswap_write_in_flight_limit is bigger than IO in flight number of > + * swap device > + */ Please use the documented multi-line comment format. E.g.: /* * Store failed because zswap_read_in_flight_limit or * zswap_write_in_flight_limit is bigger than IO in flight number of * swap device. */ > +static u64 zswap_reject_io; > +#endif > /* Duplicate store was encountered (rare) */ > static u64 zswap_duplicate_entry; > > @@ -114,6 +121,22 @@ static bool zswap_same_filled_pages_enabled = true; > module_param_named(same_filled_pages_enabled, zswap_same_filled_pages_enabled, > bool, 0644); > > +#ifdef CONFIG_ZSWAP_IO_SWITCH > +/* zswap will not try to store the page if zswap_read_in_flight_limit is > + * bigger than IO read in flight number of swap device > + */ Use documented multi-line comment format. > +static unsigned int zswap_read_in_flight_limit; > +module_param_named(read_in_flight_limit, zswap_read_in_flight_limit, > + uint, 0644); > + > +/* zswap will not try to store the page if zswap_write_in_flight_limit is > + * bigger than IO write in flight number of swap device > + */ ditto. thanks. -- ~Randy