Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp219230imm; Tue, 31 Jul 2018 17:15:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe/cJEnSn5DRh0aM1rSD3Ds1KztUIMRG5d7LUgGgWM3/aA2rKueGeWcrkN8c8t3QiSj6Bz/ X-Received: by 2002:a17:902:7009:: with SMTP id y9-v6mr22913594plk.249.1533082542618; Tue, 31 Jul 2018 17:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533082542; cv=none; d=google.com; s=arc-20160816; b=HQSFYZAj+OpJWlbq10QiPXKKS/PZOhY25ZR4XcGnu0kgw4Gp0uWuYWD+CGGbTGP3Ip DK/pXZChdSReA9hNe09LVoBwXZc3nY3EpAzkTAhmYl9qqzeH65mff3EO9eq6sChllFsu Z+zaU0AXrzSsfFRtlNeOYESitOPUx/+yzm7p5mRGBgVd7GEJJqtAjVR5FhWq0avW5frb IITZ1TD/Ec9eAFKzfWoQ8SYPu2iXLsw+19F8XKL9MmodTDMhcQhKFZshbgoZREtIanyv e6Phz+WDQ06W/aqowvTTe2ACEqwOSXsbBMSPv5XupseKWJftXHdcbTLC9fPmzOIXuW0z hjrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=8hbCxSSvjynegbwc6JUA/AjSJv2dQtfCLL+Gbz5ydr4=; b=lq496iNXh0MXyaJkFrmhICUv/YNiJJAFHSvTDmMXYyHetLIK+5tI1ByuGS3h5HpM9Q tlYejQJZoSnS6WI0L7hbua8qGkhXRek+q0Vku77mjzag/dlChfFRKtCYwxz9JzOdB9rS xe9Ux+NZIUP7LcwJW5fb3tL2yu+wkT2xcfwM5mKC4Jbo2R+chvnmKAZBoqfxCEEll8Xj SMHht1Hxm0MChAdFUwvhWGBWl1kdBRP1eptQxN76yGAzhU6/troPKc0fpvfw3vMOK/s3 x/+v1VYIUPP7oRlc4gKPVbVVKq8UUAEB7QBaYXVBACar+AR+9xKRW8KV5vpjhdImmK0I 0j7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g0uEoSem; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si5361135plw.81.2018.07.31.17.15.28; Tue, 31 Jul 2018 17:15:42 -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=pass header.i=@gmail.com header.s=20161025 header.b=g0uEoSem; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732891AbeHAB4b (ORCPT + 99 others); Tue, 31 Jul 2018 21:56:31 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45403 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732833AbeHAB4a (ORCPT ); Tue, 31 Jul 2018 21:56:30 -0400 Received: by mail-pl0-f68.google.com with SMTP id j8-v6so7883529pll.12; Tue, 31 Jul 2018 17:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8hbCxSSvjynegbwc6JUA/AjSJv2dQtfCLL+Gbz5ydr4=; b=g0uEoSemwGBnKorEKlHXZFpt46haBEVpI+8ytpoH4QDYP98CKLLlI7eFRH/eHd3qYN S15sqGDdvYft5FGdbWNIR5415XaGYyl6zTdeNGsgSAcjx3hiYRMNMtNwBm4NJ7tEa4is ty1EGWUdifHJr01o4/1bc9KIwZe4GTlgxB1JgyMh4zimgqimBgVVM39x7f7kPne/EDCk xz8tkj4uoICc5RMNJodht4k7dOvFnxWAlGO+dvW0kwPQ67EGLaL6zyqP5NTfIEQqUAoq M3SHC8BoGDvpo0kK9UEnuDFZppAI1BD8OiqfHb5MigZ2pQWTWTvnphgYcRXPIyhFcXLY PYaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8hbCxSSvjynegbwc6JUA/AjSJv2dQtfCLL+Gbz5ydr4=; b=HuxJryNi8mybzjpQRfU3oXf1S4dycK3lLgoZsghne3Wlh3HfYseOjs+QmKxinZui7i Fd2M6hm3Fxrx6G/UxovpOaPSQDLhQnZqrkhGBooyDoIjthCNHOvs6N9qUepDAJjmFfeU q2KaAeRLhW95xDty38DXcnxu78NDnIp0DY65tuqA+hJUEfP7mfpbiJL9Ee0pDIZqPMyI jGKo1Fb0VojDUn+VCCcB8gWBo9ubs1e+HgYw8sv2AIeT412I/YykF60KLpLQCun6F1Gx LnaUcRjpZXY51PDAv+6mw8g4+gPy4M7+wcKnECdWH/KHCG8vaXwr080k5fVDTJhigJ/X 9DKg== X-Gm-Message-State: AOUpUlERcjCaLzfmu4foZavpqq/WqF0qxhHHtDE0dVqYeXUHiiQ1L8Ds fnD9h6yU++Jo3BQhcb2Py9VnOATXMqV3xw== X-Received: by 2002:a17:902:e088:: with SMTP id cb8-v6mr22572963plb.189.1533082422478; Tue, 31 Jul 2018 17:13:42 -0700 (PDT) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c090:180::1:6163]) by smtp.gmail.com with ESMTPSA id c142-v6sm20029114pfb.62.2018.07.31.17.13.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 17:13:41 -0700 (PDT) Date: Tue, 31 Jul 2018 17:13:28 -0700 From: Dennis Zhou To: Johannes Weiner Cc: Tejun Heo , Jens Axboe , Josef Bacik , kernel-team@fb.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] block: make iolatency avg_lat exponentially decay Message-ID: <20180801001326.GA34556@dennisz-mbp.dhcp.thefacebook.com> References: <20180731203647.19864-1-dennisszhou@gmail.com> <20180731212150.GA7027@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180731212150.GA7027@cmpxchg.org> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Johannes, On Tue, Jul 31, 2018 at 05:21:50PM -0400, Johannes Weiner wrote: > Hi Dennis, > > this generally looks good to me. Just two small nit picks: > > On Tue, Jul 31, 2018 at 01:36:47PM -0700, Dennis Zhou wrote: > > @@ -135,6 +135,24 @@ struct iolatency_grp { > > struct child_latency_info child_lat; > > }; > > > > +#define BLKIOLATENCY_MIN_WIN_SIZE (100 * NSEC_PER_MSEC) > > +#define BLKIOLATENCY_MAX_WIN_SIZE NSEC_PER_SEC > > +/* > > + * These are the constants used to fake the fixed-point moving average > > + * calculation just like load average. The latency window is bucketed to > > + * try to approximately calculate average latency for the last 1 minute. > > + */ > > +#define BLKIOLATENCY_NR_EXP_FACTORS 5 > > +#define BLKIOLATENCY_EXP_BUCKET_SIZE (BLKIOLATENCY_MAX_WIN_SIZE / \ > > + (BLKIOLATENCY_NR_EXP_FACTORS - 1)) > > +static const u64 iolatency_exp_factors[BLKIOLATENCY_NR_EXP_FACTORS] = { > > + 2045, // exp(1/600) - 600 samples > > + 2039, // exp(1/240) - 240 samples > > + 2031, // exp(1/120) - 120 samples > > + 2023, // exp(1/80) - 80 samples > > + 2014, // exp(1/60) - 60 samples > > Might be useful to drop the FIXED_1 name in a comment here. It says > "fixed-point", and "load average", but since the numbers are directly > in relationship to that constant, it'd be good to name it I think. > I've added a comment in v2 that points out FIXED_1 and mentions its value is 2048. I also explained a little more about the samples and binding the 1/exp window. > > + exp_idx = min_t(int, BLKIOLATENCY_NR_EXP_FACTORS - 1, > > + iolat->cur_win_nsec / BLKIOLATENCY_EXP_BUCKET_SIZE); > > + CALC_LOAD(iolat->total_lat_avg, iolatency_exp_factors[exp_idx], > > + stat.mean); > > The load average keeps the running value in fixed point presentation > to avoid rounding errors. I guess because this is IO time in ns, the > values are so much higher than the FIXED_1 denominator (2048) that > rounding errors are negligible, and we don't need to bother with it. > > Can you mention that in a comment, please? I've added what you said here in a comment above this. Thanks, Dennis