Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp429030imu; Mon, 26 Nov 2018 12:56:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/WSujhVR2DAMSu4i2SV1fJ4KWG7NWD/9h+BmJmoTCuFnr651zcg5z3/eYsfdor5T8pIgocw X-Received: by 2002:a17:902:7581:: with SMTP id j1mr29637162pll.308.1543265774814; Mon, 26 Nov 2018 12:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543265774; cv=none; d=google.com; s=arc-20160816; b=z/7v9bw/9IuHr4LJ+qXsSfylQZYwc1bJZOQ0wE1b1GNMDab/ID6wnstpj5wxEdmMq+ 8TtfDxySuTlBQ3lXNwFXi3pn8hnB5pvXLAji86s/jclupFFb2EKr9+vFfT8l10nZYBdZ yanRn2Yqp3g86ctDlsH22BXgUCVuP5yYYQiZTvkXiWsNk1kOav9GLV4jqCxoZpx79Jrl JpQUQDKyCAf9uFdomFmoGQvb3U7Lsfe/MI4klthYmoiB+WS63e6BlfUSr2gM5C6ZE44+ pmRhbznvoGgrrUlqa8mHwZWOsrapDYJ/ZkZql7lSfvFon3CCknhmPguREAfrLQ2MfWwC Lilg== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=kp3gp6nvpVa9/6s4dV6Wy8AIoAK0MT6To/pMd3z1JAc=; b=m457z7Zv4xCP84RXd+SGXJ6SxgU5Xnio07nRJTF9fj4WuCBcG29AFpIkXMxS4TFUm+ pZhKQyKoxnVDC763Ko/r9k9DqPPhdoz88FW/4jyK0B0ymYl2/qOsZR8DTki/I5Xdblfc /Iobt4MjlPQx4YMWhXdStZbi7mIYIi/23FgvNqKI8cw9izVZWDAINO19F0mBuFB3uHCu Rk27brHEGUBlm3O3l8kM9sv4R8fjCzjO68nsGZESSrDDIdUuSVnAErFGicMzXIJxeLIE pFmqFDwKbu6GL8OjENOuhI9M5+sHHV0OEoE7UcuYPiEpgdsy46bqS1Bg8gVwNDawLF7S /6uQ== 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 x2si1327599pgi.152.2018.11.26.12.55.59; Mon, 26 Nov 2018 12:56:14 -0800 (PST) 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 S1727341AbeK0HuJ (ORCPT + 99 others); Tue, 27 Nov 2018 02:50:09 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37826 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727105AbeK0HuJ (ORCPT ); Tue, 27 Nov 2018 02:50:09 -0500 Received: from localhost.localdomain (c-24-6-170-16.hsd1.ca.comcast.net [24.6.170.16]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 49014B0A; Mon, 26 Nov 2018 20:54:47 +0000 (UTC) Date: Mon, 26 Nov 2018 12:54:46 -0800 From: Andrew Morton To: Minchan Kim Cc: LKML , Sergey Senozhatsky Subject: Re: [PATCH v2 7/7] zram: writeback throttle Message-Id: <20181126125446.562aca37cc7c0dd8456c3a25@linux-foundation.org> In-Reply-To: <20181126082813.81977-8-minchan@kernel.org> References: <20181126082813.81977-1-minchan@kernel.org> <20181126082813.81977-8-minchan@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Nov 2018 17:28:13 +0900 Minchan Kim wrote: > On small memory system, there are lots of write IO so if we use > flash device as swap, there would be serious flash wearout. > To overcome the problem, system developers need to design write > limitation strategy to guarantee flash health for entire product life. > > This patch creates a new konb "writeback_limit" on zram. With that, > if current writeback IO count(/sys/block/zramX/io_stat) excceds > the limitation, zram stops further writeback until admin can reset > the limit. > > +++ b/Documentation/ABI/testing/sysfs-block-zram > @@ -121,3 +121,12 @@ Contact: Minchan Kim > The bd_stat file is read-only and represents backing device's > statistics (bd_count, bd_reads, bd_writes) in a format > similar to block layer statistics file format. > + > +What: /sys/block/zram/writeback_limit > +Date: November 2018 > +Contact: Minchan Kim > +Description: > + The writeback_limit file is read-write and specifies the maximum > + amount of writeback ZRAM can do. The limit could be changed > + in run time and "0" means disable the limit. > + No limit is the initial state. > diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt > index 550bca77d322..41748d52712d 100644 > --- a/Documentation/blockdev/zram.txt > +++ b/Documentation/blockdev/zram.txt > @@ -164,6 +164,8 @@ reset WO trigger device reset > mem_used_max WO reset the `mem_used_max' counter (see later) > mem_limit WO specifies the maximum amount of memory ZRAM can use > to store the compressed data > +writeback_limit WO specifies the maximum amount of write IO zram can > + write out to backing device Neither the changelog nor the Documentation specify the units of writeback_limit. Bytes? Pages? Blocks? This gets so confusing that in many /proc/sys/vm files we actually put the units into the filenames.