Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1166969rwl; Thu, 10 Aug 2023 07:23:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsUXEK4qQCJ0EBzCTQM1Uq4Sflvt2I6JsNc2PfRFPeE4WO7mTwmFSDxZdnjHdlAV6MdLWM X-Received: by 2002:a05:6a00:850:b0:687:7b0a:fae4 with SMTP id q16-20020a056a00085000b006877b0afae4mr3484838pfk.0.1691677437811; Thu, 10 Aug 2023 07:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691677437; cv=none; d=google.com; s=arc-20160816; b=K52Wv4WNWPvRHJrUIjl/a3vk/k0OCw3RBB5VU8HG+JWg9QCYL6fSfI1HwbaRs11Qae K7GYhEy5UaQX2oYbwHJ9vwmS0VxhOLgvCCHVuUqhPzm0LsoNRbnVKM1hXjZaYtdvyIK5 RCENpwwx6cFOlEOrmcKJByKp9Qg/i42gyYVRo6X9R9suA9HBoOgI8BYqi4JP1b/ppvbG KAAv+DJ4cVSe7AauHGewwcFnjOGDV+2tRoL5/blQW1Pa+Sv93W4j3eqrZXFOS9cMrHJN wHKTeQzvni8ip85EhHEp8ZxGgvlovuDUaNBRllVvwXBHv2MY3BrfHzemF0oyMxV9psJw 4vag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=WZ76gwOie6WLXdkbrw1HRq/CP2d9byN7ptDDfxPstwA=; fh=W2r1iZBITaPgmMWmplcLmQMVWTfdf6Q2BcOzkWga+Y0=; b=DY7dAbDp884ACr6gBtg96azkUPClzXJeMOiwZlEJp7ZT/yshf3xFiiue3HEu8XZMPe GqQKxDvhvLIS0eZafXIVmENM41sDtdOcQvhLJXskLUB//JCjy8TvO2DcKC+tcd/uWy8Z XvLVfrBJLRrfQW9bl2ctZtThohYNrSaVj2VVGTDkWXI6FbYcMtGdWLgh8xM6IXXemHej vwKzbdmYcTyTtqbSszHumuYiEgiOvK7J5MKZcZhEyd38yT/qMRVRscHKpIW13alvspBO kvmhrLNavbubtP7HLUFUSe6IbqUlw0cifrx9cfugkfiHywteleS6EZsAVqYlEbo4DlAg Jgww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by14-20020a056a00400e00b0068208d19b23si1566326pfb.311.2023.08.10.07.23.45; Thu, 10 Aug 2023 07:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234726AbjHJNQ3 (ORCPT + 99 others); Thu, 10 Aug 2023 09:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjHJNQ2 (ORCPT ); Thu, 10 Aug 2023 09:16:28 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC3226A2 for ; Thu, 10 Aug 2023 06:16:26 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RM6mQ0ZXFzCrLy; Thu, 10 Aug 2023 21:12:54 +0800 (CST) Received: from hulk-vt.huawei.com (10.67.174.118) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 10 Aug 2023 21:16:22 +0800 From: Lu Jialin To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider CC: Lu Jialin , Subject: [PATCH] psi: update psi irqtime when the irq delta is nozero Date: Thu, 10 Aug 2023 13:15:14 +0000 Message-ID: <20230810131514.910401-1-lujialin4@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.118] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If update psi irqtime whether the irq delta is zero or not, the performance will be degradation when update_rq_clock_task works frequently. Therefore, just update psi irqtime whether the irq delta is nozero. performace test of times(libmicro): 1) without psi_account_irqtime in update_rq_clock_task [root@arm64_perf]# ./times -E -C 200 -L -S -W -N "times" -I 200 Running: times# ./../bin-arm64/times -E -C 200 -L -S -W -N times -I 200 prc thr usecs/call samples errors cnt/samp times 1 1 0.45210 188 0 500 2) psi_account_irqtime in update_rq_clock_task [root@arm64_perf]# ./times -E -C 200 -L -S -W -N "times" -I 200 Running: times# ./../bin-arm64/times -E -C 200 -L -S -W -N times -I 200 prc thr usecs/call samples errors cnt/samp times 1 1 0.49408 196 0 500 3) psi_account_irqtime in update_rq_clock_task when irq delta is nozero [root@arm64_perf]# ./times -E -C 200 -L -S -W -N "times" -I 200 Running: times# ./../bin-arm64/times -E -C 200 -L -S -W -N times -I 200 prc thr usecs/call samples errors cnt/samp times 1 1 0.45158 195 0 500 Signed-off-by: Lu Jialin --- kernel/sched/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c52c2eba7c73..69c4f229d6d1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -722,7 +722,8 @@ static void update_rq_clock_task(struct rq *rq, s64 delta) rq->prev_irq_time += irq_delta; delta -= irq_delta; - psi_account_irqtime(rq->curr, irq_delta); + if (irq_delta) + psi_account_irqtime(rq->curr, irq_delta); delayacct_irq(rq->curr, irq_delta); #endif #ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING -- 2.34.1