From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB907C32755 for ; Mon, 23 Sep 2019 15:06:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7D74C20835 for ; Mon, 23 Sep 2019 15:06:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yandex-team.ru header.i=@yandex-team.ru header.b="xZgx83uA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D74C20835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=yandex-team.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE5466B000D; Mon, 23 Sep 2019 11:06:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E95EE6B000E; Mon, 23 Sep 2019 11:06:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D82E26B0010; Mon, 23 Sep 2019 11:06:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id B0FAB6B000D for ; Mon, 23 Sep 2019 11:06:52 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 55EF5180AD80C for ; Mon, 23 Sep 2019 15:06:52 +0000 (UTC) X-FDA: 75966512664.25.cake90_1ebc283a4594e X-HE-Tag: cake90_1ebc283a4594e X-Filterd-Recvd-Size: 4609 Received: from forwardcorp1j.mail.yandex.net (forwardcorp1j.mail.yandex.net [5.45.199.163]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Sep 2019 15:06:51 +0000 (UTC) Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 555682E147E; Mon, 23 Sep 2019 18:06:48 +0300 (MSK) Received: from vla5-2bf13a090f43.qloud-c.yandex.net (vla5-2bf13a090f43.qloud-c.yandex.net [2a02:6b8:c18:3411:0:640:2bf1:3a09]) by mxbackcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LXwfn27u5e-6lL4Kv1i; Mon, 23 Sep 2019 18:06:48 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1569251208; bh=Y6U3tSiPz0hrvdsJTx8ZUTeNaokC8gQiPkS2jx87AIQ=; h=In-Reply-To:Message-ID:From:Date:References:To:Subject:Cc; b=xZgx83uAgxA0VhhQbGmhCg+PnNLqeqd12GXqBk8hHY2zSJIyt8dLriJFw4G9LwGqc GwgYtxnwEHnlSpGcxlpW5CRFFwXeGJRLt07cCKcT3qn59huunmpRnR69Qj9qZrgJ7y O3CdfuF9CB6Oq3/PmR/qvEYAW77O6pBBlVlWaIIs= Authentication-Results: mxbackcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:344a:8fe6:6594:f7b2]) by vla5-2bf13a090f43.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id BZTsvyuZ7l-6kIG6iKd; Mon, 23 Sep 2019 18:06:47 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: Re: [PATCH v2] mm: implement write-behind policy for sequential file writes To: Tejun Heo Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jens Axboe , Michal Hocko , Dave Chinner , Mel Gorman , Johannes Weiner , Linus Torvalds References: <156896493723.4334.13340481207144634918.stgit@buzz> <875f3b55-4fe1-e2c3-5bee-ca79e4668e72@yandex-team.ru> <20190923145242.GF2233839@devbig004.ftw2.facebook.com> From: Konstantin Khlebnikov Message-ID: Date: Mon, 23 Sep 2019 18:06:46 +0300 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: <20190923145242.GF2233839@devbig004.ftw2.facebook.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 23/09/2019 17.52, Tejun Heo wrote: > Hello, Konstantin. > > On Fri, Sep 20, 2019 at 10:39:33AM +0300, Konstantin Khlebnikov wrote: >> With vm.dirty_write_behind 1 or 2 files are written even faster and > > Is the faster speed reproducible? I don't quite understand why this > would be. Writing to disk simply starts earlier. > >> during copying amount of dirty memory always stays around at 16MiB. > > The following is the test part of a slightly modified version of your > test script which should run fine on any modern systems. > > for mode in 0 1; do > if [ $mode == 0 ]; then > prefix='' > else > prefix='systemd-run --user --scope -p MemoryMax=64M' > fi > > echo COPY > time $prefix cp -r dummy copy > > grep Dirty /proc/meminfo > > echo SYNC > time sync > > rm -fr copy > done > > and the result looks like the following. > > $ ./test-writebehind.sh > SIZE > 3.3G dummy > COPY > > real 0m2.859s > user 0m0.015s > sys 0m2.843s > Dirty: 3416780 kB > SYNC > > real 0m34.008s > user 0m0.000s > sys 0m0.008s > COPY > Running scope as unit: run-r69dca5326a9a435d80e036435ff9e1da.scope > > real 0m32.267s > user 0m0.032s > sys 0m4.186s > Dirty: 14304 kB > SYNC > > real 0m1.783s > user 0m0.000s > sys 0m0.006s > > This is how we are solving the massive dirtier problem. It's easy, > works pretty well and can easily be tailored to the specific > requirements. > > Generic write-behind would definitely have other benefits and also a > bunch of regression possibilities. I'm not trying to say that > write-behind isn't a good idea but it'd be useful to consider that a > good portion of the benefits can already be obtained fairly easily. > I'm afraid this could end badly if each simple task like file copying will require own systemd job and container with manual tuning.