Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1553156imm; Wed, 6 Jun 2018 18:45:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIFbc7CGgZPa/RRoARTHg6hlWzo5jObgvjeCzmbb03O8DRDDl7YRt5CeL7GSeJoT5UQNd3x X-Received: by 2002:a17:902:6847:: with SMTP id f7-v6mr5672486pln.173.1528335938052; Wed, 06 Jun 2018 18:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528335938; cv=none; d=google.com; s=arc-20160816; b=eQo7/wSVwqRkJanPAk4+NqIUrUC6XjoptHWQeGa/GBC0drUkJ8rk9IeXgWyl9KieI5 oU6uCQBsXtw4NPUbdtQ2Qq7CNjNqt/MbBEho5F9doAbF438XoY/oJrV7Ch071DBJiS9Q CXKzEfbNA/26oFvM4kkBF6MwnyrJadDzTYulsJu/1wzqcReZcfc5veCkVIICLt9/lsS9 B/hC01M7zxLBvGGNKFh2f2wcOnoryP812cl2+KBhRUP7S6b1TuwC8t3YxusdEo18nvMU x8o0QJzCzuhLrbR+9y0bcHBjYm0SPcix9DUqXm3BDfkhEgaxnNvOEregOCRpcbN6tZ74 Tp9Q== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=QRcPTJiVa8mTVEOhxd5W3GsgBdp1HtlMNAXYyca++nM=; b=dPeDhGvCdQOqrVBzz4ICG1P3u1KyfZhHJSR/1RA25MgfFB7oXUv8ANyd8rPdY+UXyn Q2LobfTmjBspV61d5JTgQKJm763DVhQ7YnKfdm67HHdoRpxaWoDy52/WQUuMohk9ymHg 9/UX5BNw1BxhIShrLUB7eyS5snk9fzDRRH+eiBlTt9vS8FtzL9ZNx+dp5X7tUXsZny/p FJq2le22dDMPAlf3UbIVdKYpjYtfF411sD/5+/OvGgVoSwzZIXpBlpT7gmcpgtOD/vjk 82qmzJd5Xzur1Tay37mRFFivap4/vedSAnQRMENo+CcyhgqwtFgPU7AHAPNjgWKUINXw vIlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z2F23kHX; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82-v6si25765730pgh.144.2018.06.06.18.45.23; Wed, 06 Jun 2018 18:45:38 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z2F23kHX; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbeFGBnW (ORCPT + 99 others); Wed, 6 Jun 2018 21:43:22 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:43410 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752322AbeFGBnV (ORCPT ); Wed, 6 Jun 2018 21:43:21 -0400 Received: by mail-pf0-f195.google.com with SMTP id j20-v6so4021191pff.10 for ; Wed, 06 Jun 2018 18:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QRcPTJiVa8mTVEOhxd5W3GsgBdp1HtlMNAXYyca++nM=; b=Z2F23kHXPf1D2iDf1/CWCJBb4UL2aiBeuJrp+jDGg9hWy2IfTg55bbTGiITGIX6XIc tsMwVabBBFHEERxM0xwCUVop7iwyMyiNXxZBgS+kCskfqW7tJcwUgM+AfCbHHkFgvZ3p Blp21pq28L4l/zlkDxMP4mlYIa1cJp629SLc2hCPZmY9siXRcdDPXkZt4FmiDa2CMJ3L 2rLoFTz7MzKmpHtAEjjteRbi9qOGzC5OEUNJb63m1PmNpxbZkfx7UQNgoss+ZPBcbUBk UxnzMXRekofFdFjk4MJxltTmasGd15SaGS0KHgLny1O5BwovH/LDs7t0yogs9xyuik1f G5og== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=QRcPTJiVa8mTVEOhxd5W3GsgBdp1HtlMNAXYyca++nM=; b=o9VBYm1AS23GORoLAofC5GvTyD0EasGAjAJUHWWhmp89K0ze3axLeQb10uPUjfeBHJ 1OozIr34woId64Zl4+2UbTBER2ctEU14s5YWxE+glzoJLJEV8rnE+Ggegc6ZRDa0n1bK C8rbZySXSHSxSoDXivqR35CcW43T0FbzRGMkE8V126owOnQrZcS5UuU2yAffF203SQg0 dpOwjOtrLDeupvWKOoJ+pVNBMewOQqrB9F7m6Kgwv931VjuaavB4eHkiiWtm601aIYyj X77viwkFWCHB9we9x+GRKbBXRv15RntMnLxXJm7x4p439/MGE/4i6b+HT9v7J91eluq4 3CVQ== X-Gm-Message-State: APt69E0N+PgsYH3pPEM7ldpoHKGSYKO2yA4+i5D0ibme3FLUmzPRAcu8 naxctQ5Cf26y8xzrf8jmHzyWbw== X-Received: by 2002:a62:1013:: with SMTP id y19-v6mr4632037pfi.166.1528335801111; Wed, 06 Jun 2018 18:43:21 -0700 (PDT) Received: from roar.ozlabs.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id w125-v6sm2218469pgb.92.2018.06.06.18.43.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jun 2018 18:43:20 -0700 (PDT) Date: Thu, 7 Jun 2018 11:43:04 +1000 From: Nicholas Piggin To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Frederic Weisbecker , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v4 1/2] powerpc/time: Only set CONFIG_ARCH_HAS_SCALED_CPUTIME on PPC64 Message-ID: <20180607114304.327c4ab5@roar.ozlabs.ibm.com> In-Reply-To: References: X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 Jun 2018 14:21:08 +0000 (UTC) Christophe Leroy wrote: > scaled cputime is only meaningfull when the processor has > SPURR and/or PURR, which means only on PPC64. > > Removing it on PPC32 significantly reduces the size of > vtime_account_system() and vtime_account_idle() on an 8xx: > > Before: > 00000000 l F .text 000000a8 vtime_delta > 00000280 g F .text 0000010c vtime_account_system > 0000038c g F .text 00000048 vtime_account_idle > > After: > (vtime_delta gets inlined in the two functions) > 000001d8 g F .text 000000a0 vtime_account_system > 00000278 g F .text 00000038 vtime_account_idle > > In terms of performance, we also get approximatly 5% improvement on task switch: > The following small benchmark app is run with perf stat: > > void *thread(void *arg) > { > int i; > > for (i = 0; i < atoi((char*)arg); i++) > pthread_yield(); > } > > int main(int argc, char **argv) > { > pthread_t th1, th2; > > pthread_create(&th1, NULL, thread, argv[1]); > pthread_create(&th2, NULL, thread, argv[1]); > pthread_join(th1, NULL); > pthread_join(th2, NULL); > > return 0; > } > > Before the patch: > > ~# perf stat chrt -f 98 ./sched 100000 > > Performance counter stats for 'chrt -f 98 ./sched 100000': > > 8622.166272 task-clock (msec) # 0.955 CPUs utilized > 200027 context-switches # 0.023 M/sec > > After the patch: > > ~# perf stat chrt -f 98 ./sched 100000 > > Performance counter stats for 'chrt -f 98 ./sched 100000': > > 8207.090048 task-clock (msec) # 0.958 CPUs utilized > 200025 context-switches # 0.024 M/sec > > Signed-off-by: Christophe Leroy This looks okay to me. Nice numbers. > --- > v4: > - Using the correct symbol CONFIG_ARCH_HAS_SCALED_CPUTIME instead of ARCH_HAS_SCALED_CPUTIME > - Grouped CONFIG_ARCH_HAS_SCALED_CPUTIME related code in dedicated functions to reduce the number of #ifdefs > - Integrated read_spurr() directly into the related function. > v3: Rebased following modifications in xmon.c > v2: added ifdefs in xmon to fix compilation error > > arch/powerpc/Kconfig | 2 +- > arch/powerpc/include/asm/accounting.h | 4 ++ > arch/powerpc/include/asm/cputime.h | 1 - > arch/powerpc/kernel/time.c | 111 +++++++++++++++++++++------------- > arch/powerpc/xmon/xmon.c | 4 ++ > 5 files changed, 77 insertions(+), 45 deletions(-) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index b62a16e2c7cc..735398fd390d 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -142,7 +142,7 @@ config PPC > select ARCH_HAS_PHYS_TO_DMA > select ARCH_HAS_PMEM_API if PPC64 > select ARCH_HAS_MEMBARRIER_CALLBACKS > - select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE > + select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC64 I wonder if we could make this depend on PPC_PSERIES or even PPC_SPLPAR as well? (That would be for a later patch) Thanks, Nick