Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1383886pxy; Thu, 6 May 2021 07:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXXS4TG2bXmzDb5c/WKI0nbLn1bf0lUODsza8J4nfLgVGNX2eWoaJ4NuyDPugfvi9mACAw X-Received: by 2002:a05:6402:177c:: with SMTP id da28mr5244412edb.135.1620309678136; Thu, 06 May 2021 07:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620309678; cv=none; d=google.com; s=arc-20160816; b=E2V43AKs9upcharj1V/CLzcgKZ5cfAmZdAzm/jUXPQZqkyYgCmXajltPcqtrJ7od8n Cs6vmpjsoR0v3dl9yN5gciX6Vp5S1uzuOICM8Wj+cnCyt0syFbHthnZPK6B1nvaMf3C6 GUhR2MLTaz3Lg82If+qElwxJBp60dOL9GjFOw3g15KVOM9vEnqfG/i/wmtuTrJER9LxH X7gneIlUVzhki+JbB6AUNHfDHhNdsRlSf4bnc+nwfWd7D2RLtbpsmgpbeJWnaQKaAcNN Z8nACG6XJnwe9D/OudPdO5F6C4CfyfJHu4PgzDj0CUjwoi4BMRDzVDTa48KFfou3D5H0 WMdw== 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:dkim-signature; bh=RM27Ns39iWEEvy6Ka61huNOh4QGP2SWbqcGCbpTFK2E=; b=RCOCXi9ahKDhLZqa9a4n/fopUOD+TR8xrd7S9NyjY5IoP1RKkLq2Ie+PbhAADhMUuR 3wosrEAGdpy0eMnc65rP9vaV5m32jFk8vAYTiG3Dddu4EKDPGrBTC14B45XGsouRapIA TwmEkjoPb/1dow7BIlstsZ9T0Vti4NoCZtw+81reuUv/o4UKHe85AnrxrOC6cLgOVrWB mJEnnobq6PlqhOMpxFj8zm0ecioQ965gFHFjp7z9eWF0FIbixDgC3ImTOQcZsbLV51ba ap2SvPKBIoGGj2h6bcKkVVqvFNQXHKO/cEy6RV7qzYHw9Q9xCQcBH7OF+Rg5MnaN4wlJ Mnhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=orV9tP6G; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si2359665edw.273.2021.05.06.07.00.52; Thu, 06 May 2021 07:01:18 -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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=orV9tP6G; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234402AbhEFOAN (ORCPT + 99 others); Thu, 6 May 2021 10:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbhEFOAN (ORCPT ); Thu, 6 May 2021 10:00:13 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049C2C061761 for ; Thu, 6 May 2021 06:59:14 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id l129so4937892qke.8 for ; Thu, 06 May 2021 06:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RM27Ns39iWEEvy6Ka61huNOh4QGP2SWbqcGCbpTFK2E=; b=orV9tP6GFX8bfN1m1zZurm9KIeIF3c0L6IBGjncE4W0qvmXePnVpp4klj1Wy680U0M g5IY71MaWr60CENceOVr7xB6R2Fwsr5fw8sezMXDSK0vaxwRU2Jl1Vrr9zvz5j8u9D2S QkkVg78kh3x6LlCZ7XQBx+gZNNII7N56mRgy1s5hzAxdwjSqzLNaYBrH+A2r6lv00v3K mblqSJZWlkffmlc1EtpuR7XDPaYc7Xn8j753AcQ970Kt1xmdbLUG0fRtq6sQ29ebB7N+ kDArAjmc3HWf563GiqACFqDW1OptjdRhY7UDTPRG8DFyqBR73TzqZNZ5zYJjMgNDm4kT gaeA== 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; bh=RM27Ns39iWEEvy6Ka61huNOh4QGP2SWbqcGCbpTFK2E=; b=D/fSnxeL+oecnlBiF4zpeNo7K1jG8xAnold2cH/KclRMW9rOvzXXkPueizfB+GC6m9 bQVfv40Naq2ujpMAMuL815x1md0PTWrTvVzsbyr8EFIVGuEgZQZu28CJeRoTcl/+eD9A bkgEXVSlaTEsHKafOgNToCPdujXwjcGwNSgpiWTCVdgwrljDPxueh/WjZ1n98EO6j5V/ VWFu7KQCObhsMwnawvbAlaGHgyEx/13DJyqdH0QCtOB1HRCbIuzjasWRzT93q0hbKFSt w2kCaSE++fBI4TOZW7hS5zyKCqyWAb+8x89WcPJqB9OpAKHkLlwFF6aHeaVIhYclf1iR OHVA== X-Gm-Message-State: AOAM530QD1B4x2gPYQNIktjYZEn7xFwcjjfQy/GyYKp47cH2eH9esu3X plPP7o8bmP7M2+bYMJThARIY0g== X-Received: by 2002:a05:620a:1025:: with SMTP id a5mr3923714qkk.395.1620309554148; Thu, 06 May 2021 06:59:14 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:4c4b]) by smtp.gmail.com with ESMTPSA id s67sm1816341qkh.59.2021.05.06.06.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 06:59:13 -0700 (PDT) Date: Thu, 6 May 2021 09:59:11 -0400 From: Johannes Weiner To: Peter Zijlstra Cc: tglx@linutronix.de, mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, bsingharora@gmail.com, pbonzini@redhat.com, maz@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, riel@surriel.com Subject: Re: [PATCH 1/6] delayacct: Use sched_clock() Message-ID: References: <20210505105940.190490250@infradead.org> <20210505111525.001031466@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210505111525.001031466@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 05, 2021 at 12:59:41PM +0200, Peter Zijlstra wrote: > @@ -42,10 +42,9 @@ void __delayacct_tsk_init(struct task_st > * Finish delay accounting for a statistic using its timestamps (@start), > * accumalator (@total) and @count > */ > -static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, > - u32 *count) > +static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, u32 *count) > { > - s64 ns = ktime_get_ns() - *start; > + s64 ns = local_clock() - *start; I don't think this is safe. These time sections that have preemption and migration enabled and so might span multiple CPUs. local_clock() could end up behind *start, AFAICS.