From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751988AbdHBPll (ORCPT ); Wed, 2 Aug 2017 11:41:41 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34121 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbdHBPlj (ORCPT ); Wed, 2 Aug 2017 11:41:39 -0400 Date: Wed, 2 Aug 2017 08:41:35 -0700 From: Tejun Heo To: Peter Zijlstra Cc: lizefan@huawei.com, hannes@cmpxchg.org, mingo@redhat.com, longman@redhat.com, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, pjt@google.com, luto@amacapital.net, efault@gmx.de, torvalds@linux-foundation.org, guro@fb.com Subject: Re: [PATCH 2/2] sched: Implement interface for cgroup unified hierarchy Message-ID: <20170802154135.GI2311718@devbig577.frc2.facebook.com> References: <20170720184808.1433868-1-tj@kernel.org> <20170720184808.1433868-3-tj@kernel.org> <20170729091707.lobbicnw253wzltu@hirez.programming.kicks-ass.net> <20170801201745.GA2311718@devbig577.frc2.facebook.com> <20170801214038.sp4lw6lrnl3votte@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170801214038.sp4lw6lrnl3votte@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Peter. On Tue, Aug 01, 2017 at 11:40:38PM +0200, Peter Zijlstra wrote: > > * On cgroup2, there is only one hierarchy. It'd be great to have > > basic resource accounting enabled by default on all cgroups. Note > > that we couldn't do that on v1 because there could be any number of > > hierarchies and the cost would increase with the number of > > hierarchies. > > Yes, the whole single hierarchy thing makes doing away with the double > accounting possible. Yeah, we can either do that or make it cheaper so that we can have basic stats by default. > > * It is bothersome that we're walking up the tree each time for > > cpuacct although being percpu && just walking up the tree makes it > > relatively cheap. > > So even if its only CPU local accounting, you still have all the pointer > chasing and misses, not to mention that a faster O(depth) is still > O(depth). > > > Anyways, I'm thinking about shifting the > > aggregation to the reader side so that the hot path always only > > updates local counters in a way which can scale even when there are > > a lot of (idle) cgroups. Will follow up on this later. > > Not entirely sure I follow, we currently only update the current cgroup > and its immediate parents, no? Or are you looking to only account into > the current cgroup and propagate into the parents on reading? Yeah, shifting the cost to the readers and being smart with propagation so that reading isn't O(nr_descendants) but O(nr_descendants_which_have_run_since_last_read). That way, we can show the basic stats without taxing the hot paths with reasonable scalability. I have a couple questions about cpuacct tho. * The stat file is sampling based and the usage files are calculated from actual scheduling events. Is this because the latter is more accurate? * Why do we have user/sys breakdown in usage numbers? It tries to distinguish user or sys by looking at task_pt_regs(). I can't see how this would work (e.g. interrupt handlers never schedule) and w/o kernel preemption, the sys part is always zero. What is this number supposed to mean? Thanks. -- tejun