Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6742343ybi; Mon, 22 Jul 2019 00:47:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMiA+NW+9NZUK3jcxsQE8D0RrQ+u06KSp9COCWe5fHIzjCFBGYCtLh1EkrB00hvs2qgMTo X-Received: by 2002:a17:90a:9903:: with SMTP id b3mr75103853pjp.80.1563781641116; Mon, 22 Jul 2019 00:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563781641; cv=none; d=google.com; s=arc-20160816; b=LNCr8Kw7CcVQQbKQ36XheHbrI2aS9RuMCMd33mHqi1wFgBFFGNLAtfm/IL42UBGIeW KHKnWS51drFPc9Wmt1gwDFK/AZKaS5BGkHJUqoEtxZD0BJrBxF8U3Z60JKh/OoVnMdbZ ejWNGIyvt97sj3gmsaBu6YZ38Q/LRl8OQpAQgRtoGnW4XPzvgTRt+waVFcYu54fwdWjj +55Z4KkS+M6Ia/hLMS6JJ37T0VTbqk+awTQebcpzSSgv1utJO86WmIh9mx6OtP0bdtDD qJHS4Z1SyB774DX89yBz/X3s5L/098lHTevuUYLNh4jERyTnvOttCEmUIkFwz1ho1MP0 QncA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=FJXWDvAFaoOtMo8/HxiqAa8HymjpLqes1k0MoenBzSI=; b=AN1TCvXpEFjZLKGCtXsY7OSei1R2ns3iD2YyjhSSvmBja0+dpwOYTwwAzzPwqAStkx EE9W4qW+eue3aLXfuUi/sNQx88GthcfmiRWsz9zy/UDEuPwqU8svu47/3FmUAZUOAlxg lMYOEpzdbugwJX8RWM4usrLdXFTLS7ZOmuxmjoX2Ful1AR89g5HHCo8HlUrCweMUqlo7 OqCCfm/xtiqjdycf42JMuJ9lmJqSadTiMr/dYN2vivcoL9ksTAzqw1/llrkJcKK3BJ3b lKqIV3Csj2kzkvt8c3wfmOPfGG5JwsDM2ws5wT9Em5Z5L+IhxlzxmG/SQs4kstxhmo/n bxrA== 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 e16si8842294pgt.2.2019.07.22.00.47.05; Mon, 22 Jul 2019 00:47:21 -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 S1728060AbfGVHi6 (ORCPT + 99 others); Mon, 22 Jul 2019 03:38:58 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:38561 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbfGVHi4 (ORCPT ); Mon, 22 Jul 2019 03:38:56 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0TXUL6mK_1563781132; Received: from localhost(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TXUL6mK_1563781132) by smtp.aliyun-inc.com(127.0.0.1); Mon, 22 Jul 2019 15:38:52 +0800 From: Alex Shi Cc: Alex Shi , Ingo Molnar , Peter Zijlstra , Frederic Weisbecker , Wanpeng Li , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] cputime: remove rq parameter from irqtime_account_process_tick func Date: Mon, 22 Jul 2019 15:38:40 +0800 Message-Id: <20190722073840.32613-2-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.856.g8858448bb In-Reply-To: <20190722073840.32613-1-alex.shi@linux.alibaba.com> References: <20190722073840.32613-1-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using the per cpu rq in function internal is better and meaningful, don't need get and pass it from outside as a parameter. It also reduce the object size. with defconfig + CONFIG_IRQ_TIME_ACCOUNTING base with this patch cputime.o 10632 bytes 10568 bytes Signed-off-by: Alex Shi Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: Wanpeng Li Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org --- kernel/sched/cputime.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 5086b24d7bee..4e7a1841be86 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -354,9 +354,10 @@ void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times) * softirq as those do not count in task exec_runtime any more. */ static void irqtime_account_process_tick(struct task_struct *p, int user_tick, - struct rq *rq, int ticks) + int ticks) { u64 other, cputime = TICK_NSEC * ticks; + struct rq *rq; /* * When returning from idle, many ticks can get accounted at @@ -370,6 +371,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick, return; cputime -= other; + rq = this_rq(); if (this_cpu_ksoftirqd() == p) { /* @@ -392,9 +394,7 @@ static void irqtime_account_process_tick(struct task_struct *p, int user_tick, #ifdef CONFIG_IRQ_TIME_ACCOUNTING static void irqtime_account_idle_ticks(int ticks) { - struct rq *rq = this_rq(); - - irqtime_account_process_tick(current, 0, rq, ticks); + irqtime_account_process_tick(current, 0, ticks); } #else /* CONFIG_IRQ_TIME_ACCOUNTING */ static inline void irqtime_account_idle_ticks(int ticks) { } @@ -472,12 +472,10 @@ void thread_group_cputime_adjusted(struct task_struct *p, u64 *ut, u64 *st) */ void account_process_tick(struct task_struct *p, int user_tick) { - struct rq *rq = this_rq(); - if (vtime_accounting_cpu_enabled()) return; - irqtime_account_process_tick(p, user_tick, rq, 1); + irqtime_account_process_tick(p, user_tick, 1); } /* -- 2.19.1.856.g8858448bb