Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp628152imm; Thu, 5 Jul 2018 06:23:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUnYN+8miP2vNJJwdlpCMCgWJeOY/4zNV0UdpLGv+VFLMTRgN/OfXxehgvpBzefEFM/QIO X-Received: by 2002:a17:902:6b47:: with SMTP id g7-v6mr6234036plt.251.1530796991361; Thu, 05 Jul 2018 06:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796991; cv=none; d=google.com; s=arc-20160816; b=qgc3o2GNG71nyd0y3nf5SzQlg+5+KfcGSzRIhVu5LhjQ/7zsBemVkbUT5poyFQsLoC j7z6Kh2UmZ2m9QzC/VWJ5Hf2lbeGz31W8foOiL2r4JLvfWnYClViYG3Nv5JiwSmcRgg/ GPKhikBSkDCI2wwfbTzFZ1nI+rNoglhlWyAyeZ8fId70Mq7AFmJw/VIkOS/ltRMhpiWg EEc8OaKx7nzk02VvTdj1jKs0PsIGibalrgInmms1txy9Rsq33lOZh5tnUT1YrQwzqR4w tDgXMpSryW4DD+oXM359LAFImcNSC5YAfTcOtMXw9n04vMXg5+vll1ZI41lN18/5AZbg 3Ndg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:reply-to:arc-authentication-results; bh=ENmAEGqEPDEPpUx+aTk30GThow1h5LCtSDhvUtb+6wA=; b=aqShFJkH56g4lbDCoW3jC24zZ4nQBxYRnLO6deKF0+v8KYVnuA4rKTOxlrdyt5GwYv WB8C4E2rpQOSrAPStE+2/0JFkd0Rb0FN3iHryqgeqR6rW4A1hBgHIhSAvYvnTuugOVN8 y53UiyRCIN/ZDojQfjBqHeL18OpGISZS54Ms1tSK9BMuoFLaXnnQIMQamWtsOZgsvxCs 4AYhfyRDqBFWYKLpbP309Xruu0nj+PCLNwRve/VEdjVwSGf1/Qc+vE2SZm4LP876aLXX aKqdXp8nTZeAa7WJyQ8SqxbGIbtFNVvTSw4DDj0lWMDkXs+Gm8+WMc2sR6wvTfsxnzHi 6ucA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14-v6si6332483pfd.23.2018.07.05.06.22.57; Thu, 05 Jul 2018 06:23:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754499AbeGENVZ (ORCPT + 99 others); Thu, 5 Jul 2018 09:21:25 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:44097 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754469AbeGENVX (ORCPT ); Thu, 5 Jul 2018 09:21:23 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R301e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07486;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0T41JDi4_1530796875; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0T41JDi4_1530796875) by smtp.aliyun-inc.com(127.0.0.1); Thu, 05 Jul 2018 21:21:16 +0800 Reply-To: xlpang@linux.alibaba.com Subject: Re: [PATCH] sched/cputime: Ensure correct utime and stime proportion To: Peter Zijlstra Cc: Ingo Molnar , Frederic Weisbecker , Tejun Heo , linux-kernel@vger.kernel.org References: <20180622071542.61569-1-xlpang@linux.alibaba.com> <20180626154908.GE2458@hirez.programming.kicks-ass.net> <20180705104632.GE2494@hirez.programming.kicks-ass.net> From: Xunlei Pang Message-ID: Date: Thu, 5 Jul 2018 21:21:15 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180705104632.GE2494@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/5/18 6:46 PM, Peter Zijlstra wrote: > On Wed, Jun 27, 2018 at 08:22:42PM +0800, Xunlei Pang wrote: >> tick-based whole utime is utime_0, tick-based whole stime >> is stime_0, scheduler time is rtime_0. > >> For a long time, the process runs mainly in userspace with >> run-sleep patterns, and because two different clocks, it >> is possible to have the following condition: >> rtime_0 < utime_0 (as with little stime_0) > > I don't follow... what? > > Why are you, and why do you think it makes sense to, compare rtime_0 > against utime_0 ? > > The [us]time_0 are, per your earlier definition, ticks. They're not an > actual measure of time. Do not compare the two, that makes no bloody > sense. > [us]time_0 is task_struct:utime{stime}, I cited directly from cputime_adjust(), both in nanoseconds. I assumed "rtime_0 < utime_0" here to simple the following proof to help explain the problem we met.