Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3001015imu; Fri, 18 Jan 2019 03:06:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN5HmrrYBUK8jfQdIMGlBgkdwESPsoZRFc2rZClPR/Vk0vI/MFdIDY4HuRZykOhLaptqnPf/ X-Received: by 2002:a17:902:ba89:: with SMTP id k9mr18988217pls.189.1547809575515; Fri, 18 Jan 2019 03:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547809575; cv=none; d=google.com; s=arc-20160816; b=BjLlMNos6/w1dqViZ+RYJGMToemCLKCQa9eCnmnrXhtk7L6NTIVjdsASxU3icEwKpe 2iHlrhb1ommmfVBLZd8Z7R0SqVAxnKvY9YgAIeRsJTlPZAWKBKMKE89BFHo06PvSkuIm vRPIWRTa92yKVfI8XhueZNTtKgFXyrsGcoxztfV81GyZxw5Y0kVzL4XOKADXXSqYCPCy oZmJYNAOYfuNKxwMYI2Kc+HGGgUgkzLVYGhFD8kP7dmcr9Q08AYjQILuM1A48tpe0oI4 64PJaP0mRKtp8YSy7xkZro4RV8C/uSZK4Xwz/orv2uiv0BMkWIpOLlvS/B3wR9UYd3H1 4hoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=REsuoknvb/3a2B+SDLFUMAUKbWrBKWE0r2peyl8vGtg=; b=PISNGv/xr/2fA+bh9Jgl13W8AQ84F83Umh+XPy+vK1I/8ib71TMFSxjVTw7YnVXkdM 435beUhv2OseX3OM5T8+unAd6pvGatu84KX2vh+rBl+fLq56xBqOmZovLBZokem/2HkU 6rRo4xCHiBZFLg5nRbdoLZQ/Xt4EYb0Dt5zfO0PPLzScpbwku2xrWIMbmC4PMsA6U73o tBSFp4Lpomnvt8nfNvZawADS++uP/31YrxaMdJmhn8xl1KmF9n10ggcp8p4NMoY9SKeb jwb2xE2pcU2uVXjyuVa9jYL5a1CMzT6EufxtWheTEjAU7ncRJgPSmQsEAYXnvIu89VMA SI8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q8ilU4Va; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j191si4057862pgc.15.2019.01.18.03.05.56; Fri, 18 Jan 2019 03:06:15 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Q8ilU4Va; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727252AbfARLEX (ORCPT + 99 others); Fri, 18 Jan 2019 06:04:23 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35541 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726919AbfARLEX (ORCPT ); Fri, 18 Jan 2019 06:04:23 -0500 Received: by mail-wm1-f68.google.com with SMTP id t200so4122261wmt.0 for ; Fri, 18 Jan 2019 03:04:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=REsuoknvb/3a2B+SDLFUMAUKbWrBKWE0r2peyl8vGtg=; b=Q8ilU4VaiYC5KjBHvv91+MzS+PG8Axat78nK4i7W+o5D98gCncPk87LRZh2li+zcQU 0IpLWpQ6zgDg5i2HMnZ5jGVUuRGvb+2+9i0nJInd/4NkOlb86PcL9UFjK/3Uj92aAIUT dz4MbIlDrwI2vjcLH6e4cKZ636/X6uTk4fpvA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=REsuoknvb/3a2B+SDLFUMAUKbWrBKWE0r2peyl8vGtg=; b=NX8yoxqxSpVXyY8sawAzCHBKadOz+e03TWI4LoRno8X3YsJiE0k7+AsQ4CJfpqr1wS S66CdmIaLKkPxIH8VvWvzJbrspfb5F1pjLR1KtasvSwq1ol/eJvOAE1fe115KhwRIeGB x93BEwVJqANv1/oNQzegU494a5+vQhM3moJNiP1u+MkKJLWeW4LGfUqOLeaVy/O357ap hPar3REG8ng5gZTnu5cfkj2T/UpvJr8Eht+9IuFyRDnvu5Qkh000JvVgoK10Scj8arnm O3vweJKP1CBKDztgXmvm88/Oe4IUNGNsImkzNcKKmTYrY/+lPtcHt3v0eYuqggtd0z8w 7JqA== X-Gm-Message-State: AJcUukfkqDA9ywSdMnZx+CdfVJwvKstMfAwwhkyOCyaECpXY1qHBtJDu Q/fxF8nEfFt2Cb3ldSGJ7kC6tdP/LCw1fA== X-Received: by 2002:a7b:c5cc:: with SMTP id n12mr15364676wmk.149.1547809460341; Fri, 18 Jan 2019 03:04:20 -0800 (PST) Received: from [192.168.0.101] (146-241-71-93.dyn.eolo.it. [146.241.71.93]) by smtp.gmail.com with ESMTPSA id u204sm69011822wmu.30.2019.01.18.03.04.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 03:04:19 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [RFC PATCH 0/3] cgroup: fsio throttle controller From: Paolo Valente In-Reply-To: <20190118103127.325-1-righi.andrea@gmail.com> Date: Fri, 18 Jan 2019 12:04:17 +0100 Cc: Tejun Heo , Li Zefan , Johannes Weiner , Jens Axboe , Vivek Goyal , Josef Bacik , Dennis Zhou , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20190118103127.325-1-righi.andrea@gmail.com> To: Andrea Righi X-Mailer: Apple Mail (2.3445.102.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Il giorno 18 gen 2019, alle ore 11:31, Andrea Righi = ha scritto: >=20 > This is a redesign of my old cgroup-io-throttle controller: > https://lwn.net/Articles/330531/ >=20 > I'm resuming this old patch to point out a problem that I think is = still > not solved completely. >=20 > =3D Problem =3D >=20 > The io.max controller works really well at limiting synchronous I/O > (READs), but a lot of I/O requests are initiated outside the context = of > the process that is ultimately responsible for its creation (e.g., > WRITEs). >=20 > Throttling at the block layer in some cases is too late and we may end > up slowing down processes that are not responsible for the I/O that > is being processed at that level. >=20 > =3D Proposed solution =3D >=20 > The main idea of this controller is to split I/O measurement and I/O > throttling: I/O is measured at the block layer for READS, at page = cache > (dirty pages) for WRITEs, and processes are limited while they're > generating I/O at the VFS level, based on the measured I/O. >=20 Hi Andrea, what the about the case where two processes are dirtying the same pages? Which will be charged? Thanks, Paolo > =3D Example =3D >=20 > Here's a trivial example: create 2 cgroups, set an io.max limit of > 10MB/s, run a write-intensive workload on both and after a while, from = a > root cgroup, run "sync". >=20 > # cat /proc/self/cgroup > 0::/cg1 > # fio --rw=3Dwrite --bs=3D1M --size=3D32M --numjobs=3D16 --name=3Dseeker= --time_based --runtime=3D30 >=20 > # cat /proc/self/cgroup > 0::/cg2 > # fio --rw=3Dwrite --bs=3D1M --size=3D32M --numjobs=3D16 --name=3Dseeker= --time_based --runtime=3D30 >=20 > - io.max controller: >=20 > # echo "259:0 rbps=3D10485760 wbps=3D10485760" > = /sys/fs/cgroup/unified/cg1/io.max > # echo "259:0 rbps=3D10485760 wbps=3D10485760" > = /sys/fs/cgroup/unified/cg2/io.max >=20 > # cat /proc/self/cgroup > 0::/ > # time sync >=20 > real 0m51,241s > user 0m0,000s > sys 0m0,113s >=20 > Ideally "sync" should complete almost immediately, because the root > cgroup is unlimited and it's not doing any I/O at all, but instead = it's > blocked for more than 50 sec with io.max, because the writeback is > throttled to satisfy the io.max limits. >=20 > - fsio controller: >=20 > # echo "259:0 10 10" > /sys/fs/cgroup/unified/cg1/fsio.max_mbs > # echo "259:0 10 10" > /sys/fs/cgroup/unified/cg2/fsio.max_mbs >=20 > [you can find details about the syntax in the documentation patch] >=20 > # cat /proc/self/cgroup > 0::/ > # time sync >=20 > real 0m0,146s > user 0m0,003s > sys 0m0,001s >=20 > =3D Questions =3D >=20 > Q: Do we need another controller? > A: Probably no, I think it would be better to integrate this policy = (or > something similar) in the current blkio controller, this is just to > highlight the problem and get some ideas on how to address it. >=20 > Q: What about proportional limits / latency? > A: It should be trivial to add latency-based limits if we integrate = this in the > current I/O controller. About proportional limits (weights), they're > strictly related to I/O scheduling and since this controller doesn't = touch > I/O dispatching policies it's not trivial to implement proportional = limits > (bandwidth limiting is definitely more straightforward). >=20 > Q: Applying delays at the VFS layer doesn't prevent I/O spikes during > writeback, right? > A: Correct, the tradeoff here is to tolerate I/O bursts during = writeback to > avoid priority inversion problems in the system. >=20 > Andrea Righi (3): > fsio-throttle: documentation > fsio-throttle: controller infrastructure > fsio-throttle: instrumentation >=20 > Documentation/cgroup-v1/fsio-throttle.txt | 142 +++++++++ > block/blk-core.c | 10 + > include/linux/cgroup_subsys.h | 4 + > include/linux/fsio-throttle.h | 43 +++ > include/linux/writeback.h | 7 +- > init/Kconfig | 11 + > kernel/cgroup/Makefile | 1 + > kernel/cgroup/fsio-throttle.c | 501 = ++++++++++++++++++++++++++++++ > mm/filemap.c | 20 +- > mm/page-writeback.c | 14 +- > 10 files changed, 749 insertions(+), 4 deletions(-) >=20