Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1394702pxj; Fri, 21 May 2021 13:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR2pm6JQ/dUJIdMJiq6tOKivuI+d5fhp2u29HTWK7h14qFLRc9ADIe2WPnhKqoK0PrZT5f X-Received: by 2002:a05:6402:1d8e:: with SMTP id dk14mr13074427edb.385.1621627823435; Fri, 21 May 2021 13:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621627823; cv=none; d=google.com; s=arc-20160816; b=REe8VnN3dMWzhWV+i/cKwSBYH616RTIkEY+lOSS08jsAe68lmzRklP7hBKbg36lHSU QG3NQ8lL4DAkjcOuVrcZSF9aH0krYdyn3j15Y3R2pzspsahAykixiUKV1WMRgdpmPjiZ p6YJsPEeReV5etzHg46Zp68zQu5lj5TfvV6jibLZJE4/JdyDooOSJeLIeGXt5Z0YXxYr FW9iXWaHJSKBM4FV2HlMFyR8s7cXlSp0FI4CTwcn6T8H8xCzdoU2DwjGxS0WPeMqX07f GU/11xZHQHOwkaw/+TKC26w7QPLKNQdKmjjvQffQWBC4sWRg/tdqKgRAn+grwATjAr6I DiIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=CZP+MAkmcTb8anvu97QDudVF6rTU1Agp4jWuIbyX0Nw=; b=RQqI5Rpo9RplkJoqV/XGx4OuRi5b8E1NTYUAjTKt19bDhfpmXPMpQVk68oWTH92nda cPlJPfUv6/LV6Akcgc0CMgikioALsHraHSE9CNrFo+JTT8e2Ze/PT0ul0i3F6ihiHR2E /e11dIb5VG8w1gUO0YKt4YKcDvDSKkEPpB4hPx+16E9xr2yW7MLFSYU+mJknqxi19XGC m/JAqBfssGIaGAQgUl4ky7GSsaCfIwA29hydx7Y5U2vcN1wBLd9h2HA0btfd0bKWM3Kt kb2sWDyZiq7XqEHQ8lh8adZ1ib+UTYdqfnA34EYgATeZFKUUEzS8puX9oMfRgJkZXq3P y7iQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si5979791edv.9.2021.05.21.13.10.00; Fri, 21 May 2021 13:10:23 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbhEUInR (ORCPT + 99 others); Fri, 21 May 2021 04:43:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:58000 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233093AbhEUInP (ORCPT ); Fri, 21 May 2021 04:43:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DB976AACA; Fri, 21 May 2021 08:41:51 +0000 (UTC) Date: Fri, 21 May 2021 09:41:47 +0100 From: Mel Gorman To: "hasegawa-hitomi@fujitsu.com" Cc: Peter Zijlstra , "'fweisbec@gmail.com'" , "'mingo@kernel.org'" , "'tglx@linutronix.de'" , "'juri.lelli@redhat.com'" , "'vincent.guittot@linaro.org'" , "'dietmar.eggemann@arm.com'" , "'rostedt@goodmis.org'" , "'bsegall@google.com'" , "'bristot@redhat.com'" , "'linux-kernel@vger.kernel.org'" Subject: Re: Utime and stime are less when getrusage (RUSAGE_THREAD) is executed on a tickless CPU. Message-ID: <20210521084147.GG3672@suse.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 06:40:53AM +0000, hasegawa-hitomi@fujitsu.com wrote: > Hi Peter and Frederic > > > > > Would be superfluous for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y > > > architectures at the very least. > > > > > > It also doesn't help any of the other callers, like for example procfs. > > > > > > Something like the below ought to work and fix all variants I think. But > > > it does make the call significantly more expensive. > > > > > > Looking at thread_group_cputime() that already does something like this, > > > but that's also susceptible to a variant of this very same issue; since > > > it doesn't call it unconditionally, nor on all tasks, so if current > > > isn't part of the threadgroup and/or another task is on a nohz_full cpu, > > > things will go wobbly again. > > > > > > There's a note about syscall performance there, so clearly someone seems > > > to care about that aspect of things, but it does suck for nohz_full. > > > > > > Frederic, didn't we have remote ticks that should help with this stuff? > > > > > > And mostly I think the trade-off here is that if you run on nohz_full, > > > you're not expected to go do syscalls anyway (because they're sodding > > > expensive) and hence the accuracy of these sort of things is mostly > > > irrelevant. > > > > > > So it might be the use-case is just fundamentally bonkers and we > > > shouldn't really bother fixing this. > > > > > > Anyway? > > > > Typing be hard... that should 'obviously' be reading: Anyone? > > > I understand that there is a trade-off between performance and accuracy > and that this issue may have already been discussed. > However, as Peter mentions, the process of updating sum_exec_runtime > just before retrieving information is already implemented in > thread_group_cputime() in the root of RUSAGE_SELF etc. So, I think > RUSAGE_THREAD should follow suit and implement the same process. > I don't think it's a straight-forward issue. I know we've had to deal with bugs in the past where the overhead of getting CPU usage statistics was high enough to dominate workloads that had self-monitoring capabilities to the extent the self-monitoring was counter-productive. It was particularly problematic when self-monitoring was being activated to find the source of a slowdown. I tend to agree with Peter here that the fix may be worse than the problem ultimately where workloads are not necessarily willing to pay the cost of accuracy and as he pointed out already, it's expected nohz_full tasks are avoiding syscalls as much as possible. -- Mel Gorman SUSE Labs