Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752748AbcLFIk0 (ORCPT ); Tue, 6 Dec 2016 03:40:26 -0500 Received: from 001b2d01.pphosted.com ([148.163.156.1]:52531 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbcLFIkZ (ORCPT ); Tue, 6 Dec 2016 03:40:25 -0500 Subject: Re: [PATCH 00/10] vtime: Delay cputime accounting to tick To: Frederic Weisbecker , LKML References: <1480991543-6557-1-git-send-email-fweisbec@gmail.com> Cc: Tony Luck , Wanpeng Li , Peter Zijlstra , Michael Ellerman , Heiko Carstens , Benjamin Herrenschmidt , Thomas Gleixner , Paul Mackerras , Ingo Molnar , Fenghua Yu , Rik van Riel , Martin Schwidefsky , Stanislaw Gruszka From: Christian Borntraeger Date: Tue, 6 Dec 2016 09:40:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1480991543-6557-1-git-send-email-fweisbec@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16120608-0008-0000-0000-00000641CF3C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006202; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000194; SDB=6.00789961; UDB=6.00382506; IPR=6.00567701; BA=6.00004945; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013554; XFM=3.00000011; UTC=2016-12-06 08:40:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16120608-0009-0000-0000-00003D9C4772 Message-Id: <9e79e5e6-fdb7-d530-5aea-7bea77b7ee0a@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-06_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1612060148 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2976 Lines: 69 On 12/06/2016 03:32 AM, Frederic Weisbecker wrote: > This follows up Martin Schwidefsky's patch which propose to delay > cputime accounting to the tick in order to minimize the calls to > account_system_time() and alikes as these functions can carry quite some > overhead: > > http://lkml.kernel.org/r/20161121111728.13a0a3db@mschwide > > The set includes Martin's patch, rebased on top of tip:sched/core and > latest s390 changes, and extends it to the other implementations of > CONFIG_VIRT_CPU_ACCOUNTING_NATIVE (powerpc and ia64) along with a few > core changes to adapt the whole. > > Only built-tested though as I don't have access to any of these archs. > > git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git > vtime/acc > I have not checked the results yet (1), but this branch reduces the overhead of calculating the times a lot. I have a microbenchmark that does some simple KVM hypercalls under s390 and the average time shrinks from 280ns to 260ns. (we call accounting at guest enter and exit) About 50% of the savings seems to be Martins changes in vtime_account_irq_enter, the other 50% seems to be common code accounting doing less work. These savings of ~20ns per guest exit will also help virtio, pagefault and any other host activity on behalf of KVM guests. Nice. (1) the values seem to make sense but I have not done any calculation yet. > HEAD: ee6c393b212193bc01818c7cf4ae9cba3f469f00 > > Thanks, > Frederic > --- > > Frederic Weisbecker (9): > powerpc32: Fix stale scaled stime on context switch > ia64: Fix wrong start cputime assignment on task switch > cputime: Allow accounting system time using cpustat index > cputime: Export account_guest_time > powerpc: Prepare accounting structure for cputime flush on tick > powerpc: Migrate stolen_time field to accounting structure > powerpc/vtime: Accumulate cputime and account only on tick/task switch > ia64: Accumulate cputime and account only on tick/task switch > vtime: Rename vtime_account_user() to vtime_flush() > > Martin Schwidefsky (1): > s390/cputime: delayed accounting of system time > > > arch/ia64/include/asm/thread_info.h | 6 ++ > arch/ia64/kernel/time.c | 66 +++++++++++----- > arch/powerpc/include/asm/accounting.h | 14 +++- > arch/powerpc/include/asm/paca.h | 1 - > arch/powerpc/kernel/asm-offsets.c | 8 +- > arch/powerpc/kernel/time.c | 138 +++++++++++++++++++++------------- > arch/powerpc/xmon/xmon.c | 8 +- > arch/s390/include/asm/lowcore.h | 65 ++++++++-------- > arch/s390/include/asm/processor.h | 3 + > arch/s390/kernel/vtime.c | 116 +++++++++++++++++----------- > include/linux/kernel_stat.h | 7 +- > include/linux/vtime.h | 7 +- > kernel/sched/cputime.c | 25 +++--- > 13 files changed, 295 insertions(+), 169 deletions(-) >