Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp12589pxb; Mon, 8 Feb 2021 13:43:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzu4WIYa3CiMiAHC+vx7n9oh3v0Mgf5jPJxiJVzBgMs7FvU88JFeGsLxl3CpJfz8BugPqhL X-Received: by 2002:a17:906:4543:: with SMTP id s3mr19002186ejq.258.1612820621864; Mon, 08 Feb 2021 13:43:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612820621; cv=none; d=google.com; s=arc-20160816; b=XqxUDRrgiXCuOz91D5zu5AVOFircitPrv6KiEirBddRUGAGMDyxj+x2nmyHEbCvKAB AV8KNK2AECEI7d6+RIhgUU6VidNrV3EAXtd5eDYsK0hVmMbYJUyiF9WW455e190L1Jhv Agn9xKpPaQLVSDP/YB/x1nVFaWkkxkwQ482SOxEdPtsu3GnkVM1VIyYe18Un7W3KAPdA 7W+f3MhQM11bfHR+DQ3DiELiiLOltSmYd8ePcFT8ADoI5lWb11OgH8NYHx5G/gxU0tCN XiY3p0Z/R12RcE8hbiIdQ+77ZtwD0WJ0svP6d5E3BmjZXnPt9wPcbCL/AYrEKmiCN2Hi SNmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=tqRaxICy5YHBMmHcX2M4Wd1YNoE/TgL6qyHQaFgZCcY=; b=O2Yyvo+3pT24dOyaQBCAREq6HxhmtVHcwzFrt59sNP/BVSJYqNEUa8QBW37RRblp94 VSjrnhzHMLV8yDWuHVYMV24hAvVr8ngRwqI4fBShup/lJT2crrhlMzgtTNyizoGa5V4Y ERGQukUY0IzciY03mQ+8iPUhiyqIvmzByIgC9l9agAZoMzMkzSrVWtBqs5CRFpo0bw/x /2cU2lqbq5BTdMemRas7rTW2erhEeJuhUZPoYkWCsujsw1I6Kl95NuPUHv9cHKyNPNDJ RXEGWcoL5CKQh51HDVk1Xflo/pq10srqKRgRna2r86uN9lrcmelLkQYcobLMFh7xj9Al 85xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kbipus5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si11996896eds.251.2021.02.08.13.43.14; Mon, 08 Feb 2021 13:43:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kbipus5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236615AbhBHVit (ORCPT + 99 others); Mon, 8 Feb 2021 16:38:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232488AbhBHU65 (ORCPT ); Mon, 8 Feb 2021 15:58:57 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F1A3C061786; Mon, 8 Feb 2021 12:58:15 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id n28so4407390qtv.12; Mon, 08 Feb 2021 12:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tqRaxICy5YHBMmHcX2M4Wd1YNoE/TgL6qyHQaFgZCcY=; b=Kbipus5vPp2mNkhFtKdD511qL2yTMBCGkJZfr16sI2xPQnoo74CcVb7BKoEvNsK0Ka uhkpzga2kyNnhAT8doX26kRfoHUMEh4usIoPhV1QXcI2l7N6BuHrhC5pj7g0nRcThPfM Im3oy3HkeuZHZPj26peXKX7xI4Q9Gw27KDbhyW4CvpnP7D+0Qm76ctrraFJM+mjD5jSG 7huMyxqW0/n0d3Rm74L0WMPLdSydyk2YfXTZXTtJzY4NGFMUamuDbbqU5exQeM4Lk9US mHcN3S9Rqqm7mORgR40fI2W97hMnvhan02fsuGrxKZW1wV1MMqdvgxNdhbrDp6nPQRrs sI5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=tqRaxICy5YHBMmHcX2M4Wd1YNoE/TgL6qyHQaFgZCcY=; b=h5+jeRpsrPbwxXpWBKPtLLzO4fY/NJRwl3dAFfYi/ral3sfEcKB2pbQy73JMdrcfff UNPabLYyGDzlxcHNpgOc0Qt9TBbbKkZrZGTzby7S6FDVIQVaJduFOZrd/eDrrJAfnniO GMTIZ/+TMhVH3v7YWdUyYa/iRssjLfn1UclxXwUtfbltD10qfI5Q8jWfwxPrsL3WtPGm syy7+8txi1tc+wIFRcVE1ArF7HH/XcXC2paFNT4qe+VDg8eIFt9Wio7bRpoipCOq2VV3 qQvu1rQwGNuthvfLUMOTpbmXif7+0+M8MXFDOKqA5V0w1DAwG5M2osyD9BF/tzP2chOq fVfg== X-Gm-Message-State: AOAM533DMQcsnKDOS7NquBaJkLuxCD9VMwHcUdX7Gnms7aNe8SaLU5nQ +1I0Erc9ej2Zczo2DIPoTpA= X-Received: by 2002:ac8:5c0a:: with SMTP id i10mr16404804qti.239.1612817894151; Mon, 08 Feb 2021 12:58:14 -0800 (PST) Received: from localhost (dhcp-6c-ae-f6-dc-d8-61.cpe.echoes.net. [72.28.8.195]) by smtp.gmail.com with ESMTPSA id n4sm2933535qtp.72.2021.02.08.12.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 12:58:13 -0800 (PST) Sender: Tejun Heo Date: Mon, 8 Feb 2021 10:58:11 -0500 From: Tejun Heo To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 5/8] cgroup: rstat: punt root-level optimization to individual controllers Message-ID: References: <20210205182806.17220-1-hannes@cmpxchg.org> <20210205182806.17220-6-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Feb 08, 2021 at 03:29:21PM -0500, Johannes Weiner wrote: > > > @@ -789,6 +793,7 @@ static void blkcg_rstat_flush(struct cgroup_subsys_state *css, int cpu) > > > u64_stats_update_end(&blkg->iostat.sync); > > > > > > /* propagate global delta to parent */ > > > + /* XXX: could skip this if parent is root */ > > > if (parent) { > > > u64_stats_update_begin(&parent->iostat.sync); > > > blkg_iostat_set(&delta, &blkg->iostat.cur); > > > > Might as well update this similar to cgroup_base_stat_flush()? > > I meant to revisit that, but I'm never 100% confident when it comes to > the interaction and lifetime of css, blkcg and blkg_gq. Yeah, it does get hairy. > IIUC, the blkg_gq->parent linkage always matches the css parent > linkage; it just exists as an optimization for ancestor walks, which > would otherwise have to do radix lookups when going through the css. But yes, at least this part is straight-forward. > So with the cgroup_parent() check at the beginning of the function > making sure we're looking at a non-root group, blkg_gq->parent should > also never be NULL and I can do if (paren->parent) directly, right? I think so. > > > static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu) > > > { > > > - struct cgroup *parent = cgroup_parent(cgrp); > > > struct cgroup_rstat_cpu *rstatc = cgroup_rstat_cpu(cgrp, cpu); > > > + struct cgroup *parent = cgroup_parent(cgrp); > > > > Is this chunk intentional? > > Yeah, it puts the local variable declarations into reverse christmas > tree ordering to make them a bit easier to read. It's a while-at-it > cleanup, mostly a force of habit. I can drop it if it bothers you. I don't mind either way. Was just wondering whether it was accidental. Thanks. -- tejun