From patchwork Mon Nov 28 13:20:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 26753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5657016wrr; Mon, 28 Nov 2022 05:14:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf5a5kagtOvmby+3Ra9ERR6FqIDYyDvHm4Q4CDAK94K9ZUmyq7iWGWR2LynLQbY9voDXHzvu X-Received: by 2002:a17:90a:8d02:b0:219:1ffc:143c with SMTP id c2-20020a17090a8d0200b002191ffc143cmr10451503pjo.9.1669641284000; Mon, 28 Nov 2022 05:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669641283; cv=none; d=google.com; s=arc-20160816; b=CoYedSP5iWc8NEVoACVMPGGdxWQ7vgEZ7HU4kGsGvT/gRYVROj+9jLKEDQtHXP95Jv GSuiaW6rdAAuiL9qKBHdjAO76Yfxhn8bCdIMYPcelB2h1c8pOBAFGOOHsK1UgeKDR0Xm AlATWBavYg5QPnbsO0nHiI4N37QfWecdLpmSTX9LRlpswJHQtjBi66Z9ni0VSjxZjfl3 caFAN6y1v7qyBScE/EIfOPznZYDpMbFX1uC0xtmiKXcUb0odEYT1MxmyIY+84pQmjWBd fDsuajQPPqEoATkca87+ku3Uy8Od2rUPH09k1xULngCjzemkzl4ZmGH2WQfr7yi5xKit yOEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=6pPsulVC8b9yNYNqEg9I5BMIX3bXiY4OPVkqTr1S22g=; b=FT9Zc8EPKHWBwXHNEo1HPhJYC9dtDAmYz5yQjHJ95/HFLyFBdjwi9YstTlJtAsCh5J SEeKhWBQgfBVgKuj9+354zryHTEFZjy1EujewuLzGGUAAPNy8YkKaSVj4/6VTBpA5hoA wX3C6HYgd7ALh5iRYwx2kGGRWL2oevrJQpKrSRD3g36h9wAet7YpdmS1i2sy2z5FyJHF aj8recqVfbT+MfP4Y8FW4LFeIZTDZ6XAgwwQCa1n1d1cQbwguAnD9SrKRIHtkwrFIRBx J+gaopKq+QAPSKX6ChYg15I4gO00rFAL1w47spArVxKWEAiO1gNrxi1EW6kBdhyGYmHH B6ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CIquFBho; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oo13-20020a17090b1c8d00b00218c8b6e5efsi13678230pjb.179.2022.11.28.05.14.28; Mon, 28 Nov 2022 05:14:43 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=CIquFBho; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231789AbiK1NOC (ORCPT + 99 others); Mon, 28 Nov 2022 08:14:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbiK1NNh (ORCPT ); Mon, 28 Nov 2022 08:13:37 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43DDB1CFCF; Mon, 28 Nov 2022 05:13:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669641215; x=1701177215; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=C8o1EqWi47EMS3NLEboiqwaO6Cqj8PqboSa/beXp5NY=; b=CIquFBhoaOO+JcnTLi7Rt1q5gZb9/AhDXDPV2ooUICbRVFq3AHQFlfSD WoyyIfAMrneTWaWYNTpYjfhLsB+y/nk+cVRBnNqKoOp2lOgePfoZGw9Eo 9ysUk4bmTWUaPYoxRJ/QPmaY4QPZ7LCBei/RpGL09Wzzq62QTeGvXUQH0 VEWBACqkmUvgwONsKSMr/FNFreA2nu+2lwo2Gjv6GjtpINguY9QUm++bO St+BlwWawy1G8AhdGmg491/qACjerpzgug7iF9Tz4rIk2fSJL0eQ1Y0zn kU2NA5JTmZF5apbH9lPXpX6NvQiyrZHSNES3n2f1Rh8P7w0QwrjnBT+K9 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="401117084" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="401117084" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 05:13:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="749381335" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="749381335" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga002.fm.intel.com with ESMTP; 28 Nov 2022 05:13:32 -0800 From: Ricardo Neri To: "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot Cc: Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , Valentin Schneider , x86@kernel.org, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [PATCH v2 04/22] sched/core: Add user_tick as argument to scheduler_tick() Date: Mon, 28 Nov 2022 05:20:42 -0800 Message-Id: <20221128132100.30253-5-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221128132100.30253-1-ricardo.neri-calderon@linux.intel.com> References: <20221128132100.30253-1-ricardo.neri-calderon@linux.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750745778653704288?= X-GMAIL-MSGID: =?utf-8?q?1750745778653704288?= Differentiate between user and kernel ticks so that the scheduler updates the IPC class of the current task during the latter. Cc: Ben Segall Cc: Daniel Bristot de Oliveira Cc: Dietmar Eggemann Cc: Joel Fernandes (Google) Cc: Len Brown Cc: Mel Gorman Cc: Rafael J. Wysocki Cc: Srinivas Pandruvada Cc: Steven Rostedt Cc: Tim C. Chen Cc: Valentin Schneider Cc: x86@kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ricardo Neri --- Changes since v1: * None --- include/linux/sched.h | 2 +- kernel/sched/core.c | 2 +- kernel/time/timer.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 47ae3557ba07..ddabc7449edd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -293,7 +293,7 @@ enum { TASK_COMM_LEN = 16, }; -extern void scheduler_tick(void); +extern void scheduler_tick(bool user_tick); #define MAX_SCHEDULE_TIMEOUT LONG_MAX diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8dd43ee05534..8bb6f597c42b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5487,7 +5487,7 @@ static inline u64 cpu_resched_latency(struct rq *rq) { return 0; } * This function gets called by the timer code, with HZ frequency. * We call it with interrupts disabled. */ -void scheduler_tick(void) +void scheduler_tick(bool user_tick) { int cpu = smp_processor_id(); struct rq *rq = cpu_rq(cpu); diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 63a8ce7177dd..e15e24105891 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2073,7 +2073,7 @@ void update_process_times(int user_tick) if (in_irq()) irq_work_tick(); #endif - scheduler_tick(); + scheduler_tick(user_tick); if (IS_ENABLED(CONFIG_POSIX_TIMERS)) run_posix_cpu_timers(); }