From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753757AbdKIOwf (ORCPT ); Thu, 9 Nov 2017 09:52:35 -0500 Received: from tretyak2.mcst.ru ([80.84.125.22]:41431 "EHLO tretyak2.mcst.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752643AbdKIOwe (ORCPT ); Thu, 9 Nov 2017 09:52:34 -0500 To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, zhaolei@cn.fujitsu.com From: "Pavel V. Panteleev" Subject: [sched/core] cpuacct_charge() problem Message-ID: <5A046B8F.3060302@mcst.ru> Date: Thu, 9 Nov 2017 17:51:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r; format=flowed Content-Transfer-Encoding: 7bit X-Anti-Virus: Kaspersky Anti-Virus for Linux Mail Server 5.6.39/RELEASE, bases: 20111107 #2745587, check: 20171109 notchecked X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.1.1 (tretyak2.mcst.ru [192.168.20.110]); Thu, 09 Nov 2017 17:52:05 +0300 (GMT-3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! task_pt_regs() always show on the user regs for user thread, even if it's working in kernel mode now. So, index calculation in cpuacct_charge() isn't correct and it's always CPUACCT_STAT_USER for user thread. The time, spent in kernel mode for user task, will be lost: int index = CPUACCT_STAT_SYSTEM; struct pt_regs *regs = task_pt_regs(tsk); if (regs && user_mode(regs)) index = CPUACCT_STAT_USER;