From patchwork Tue Feb 7 05:10:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 53672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2652960wrn; Mon, 6 Feb 2023 21:03:09 -0800 (PST) X-Google-Smtp-Source: AK7set+zskyIYCvCgu2yxA8HA7AAj6J5y42fI5jBEPPr2DssiSHUW8icJOyOFIZlYw5kHTzbBbLJ X-Received: by 2002:a17:903:2448:b0:192:5ec4:6656 with SMTP id l8-20020a170903244800b001925ec46656mr2119766pls.3.1675746189616; Mon, 06 Feb 2023 21:03:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675746189; cv=none; d=google.com; s=arc-20160816; b=Hzm0EvlQhuV/17KhwhD1JbMISOay2e/aj6g2E7DimlkxwEW28/Fp/u98r1JW1S47DG +hVRZCqsDthsc4sBJlat7NAVrEQkp1Lim0F4de6K/Y/PHIL+73NBQEkdUvW1L3NVPacU rfZsyJNm6zsgREBjJjlsZR15+x6v4o8SqbaBMwawvx9X2aV+Y3yreJ3Oek4Z5GTz6DSd WM+UiTNvhuQC1NxdSpxNMHGY5vfBHE/Cux89A1fiHY6eqDUIZG39vR5OVPIjUdG26AP2 hg25JcgeCHWByg5Fu428GcpmKYCoMKO2xuIqnhI4ftRT8cswdb5OutimLaW1Zaa4ieJ1 NaTQ== 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=JCXEkSzUDRJIl8C22FBIvM+fDWc7IyJTBoI1Su50E8A=; b=pTlNj99IFm4nkjDKSL7ZLkWDMH+O+3mFObhqJqB506pW/AGHlVdln/ekh0LfhEeKRD k8QrTUoyw6dXYfOb3KpR8u8YAPL3/eDfzMShXoJnlPrwmCeoDhrxzngBI5txD89ynKM5 NBLzur+yq2152crcgz/KHbs8UZe2AC393M2n1WUnVDa6fMzymXcVav4t02wEbETBTZYb 3nzMQxCDoe94WWtxpn4HTjW5i5h1oIi2dynucWVtg/J9+aWRzqRUDZAZKm7sbepN5toy kogt4QqcuyM18craqcEwr/GlZrdLcHBCuzjZUruwYnmiusBKk1TwddtTWx/9+zsU+U5B Ss1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ep/FwozE"; 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 z8-20020a170903018800b001968124dc22si16163516plg.560.2023.02.06.21.02.54; Mon, 06 Feb 2023 21:03:09 -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="ep/FwozE"; 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 S230257AbjBGFCY (ORCPT + 99 others); Tue, 7 Feb 2023 00:02:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbjBGFBx (ORCPT ); Tue, 7 Feb 2023 00:01:53 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF374C0A; Mon, 6 Feb 2023 21:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675746109; x=1707282109; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=iDkGE/mIiTsNfeFOnUGlfr0oeLSL2C0UHOku/Uu39Qo=; b=ep/FwozEgPY3+GMxNFBQI7DFYoIlSGA70lZmUH/CqwfRw4+z9+c6iLY0 qw3YJw+vjvQqbe8YZ3NucEpnWmJDcS3Q1osfUPoU4+75i7tKjzhgNcnxo y9VJWF+4v/zKyJOqHcO4PQnyEHZigA5nMwYUuE1pbuEx7l9fM4PMzGuBc ipo0hQ8/lbMeugQxE5DAoepBYKL2GCo+1Pjs6OaOaOUGgMLeS7wzaNPmo HiMbNsbxb9FtzqTP2T0MUfoEdnAMo0v8AhzCurAn7bhez6Cf0KAsoaZT6 05BFJy61P30OuxiJgsxtNWYgw38oyKW1EwLDPz7Ae9fh0RoL4ej2TXL2K A==; X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="415625771" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="415625771" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 21:01:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="668657699" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="668657699" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga007.fm.intel.com with ESMTP; 06 Feb 2023 21:01:40 -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 , Lukasz Luba , Ionela Voinescu , x86@kernel.org, "Joel Fernandes (Google)" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [PATCH v3 04/24] sched/core: Add user_tick as argument to scheduler_tick() Date: Mon, 6 Feb 2023 21:10:45 -0800 Message-Id: <20230207051105.11575-5-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230207051105.11575-1-ricardo.neri-calderon@linux.intel.com> References: <20230207051105.11575-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?1757147236492223638?= X-GMAIL-MSGID: =?utf-8?q?1757147236492223638?= Differentiate between user and kernel ticks so that the scheduler updates the IPC class of the current task during the former. Cc: Ben Segall Cc: Daniel Bristot de Oliveira Cc: Dietmar Eggemann Cc: Ionela Voinescu Cc: Joel Fernandes (Google) Cc: Len Brown Cc: Lukasz Luba 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 v2: * Corrected error in the changeset description: the IPC class of the current task is updated at user tick. (Dietmar) 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 98f84f90a01d..10c6abdc3465 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 ed1549d28090..39d218a2f243 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5555,7 +5555,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(); }