Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5624839rwi; Sun, 23 Oct 2022 09:04:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50DTn+Np3N1rvCgJHDWta0SmoV4VAbd1QsH4AMWrFIQRA0D+rCWsjMiXqbxkuo1ZNeGGY0 X-Received: by 2002:a05:6402:4505:b0:451:1551:7b14 with SMTP id ez5-20020a056402450500b0045115517b14mr27080307edb.300.1666541099645; Sun, 23 Oct 2022 09:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666541099; cv=none; d=google.com; s=arc-20160816; b=kQnzJg6dsBFW1JMeb6tmGAs8xpSuUtyxAlRkTZef072YhgMOmiKna6GhxbziIUgazB PANH4uqsBzhe5SulOsZZUnYoMtC3nm5nK+NxPt8h5pFfLv45y0PtjxRtUpzQtgkjSUIa p9m26HHGqmjqsRUsml/rfLBWqVIjz6OXbRftz6cpWu0H4WmpL9insplz+lip++a9Bg0X cjcMDRGcUiM9Ko2BBWuuVAtdEzFrSWbEP3H4Vt6OVmlEGjzbwY5nlENW0Qri2KjBHhQC Qb5Wt6s5P4g6OC/emAx5S5J7LsweavbVSAOWFx+kc4j597f4YVfvS8QdPReixqeOyBLE Na1A== 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:dkim-signature; bh=ii9x7VwUhS2OPvr3MiuoyZ6fYnClESQwB0Azut6YqG0=; b=nLYw6hSahqIS0Zfk9R12I/Qpe73crnEEIk0xVHiNgbNkJ6S8uwdxQDTSXzO1TLI4Q/ DNOihqjE4QnlkWMMaLyX9BQdiD2iFEO01C4U2bZ5Z7aGCPnSpfF/qmshex8UH08UkFfC Svp3MWUmVn0KVrbi1czyVWmRPoGGCpDYOdzbnxVEfn5BZvyA0BB8BE7GEBSU9mrSpvxE peWXggjjZaaIfk3VhjimPxYoAB81r5OQMnZqc2T+15dEcpboPhkAiwd01Ua/lkJvadtB eiUp0oP2jihE0hAdmHbUft/8UsR7nBCqBDJTMGxZy6HYJgVGZ+O8o6qV9/AAWfyulIIg ks2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XSwUbqEo; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs17-20020a1709072d1100b0078d27c1b499si32236502ejc.500.2022.10.23.09.04.34; Sun, 23 Oct 2022 09:04:59 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=XSwUbqEo; 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 S230018AbiJWPbu (ORCPT + 99 others); Sun, 23 Oct 2022 11:31:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbiJWPbr (ORCPT ); Sun, 23 Oct 2022 11:31:47 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1569F748FB for ; Sun, 23 Oct 2022 08:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666539107; x=1698075107; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9rOfENj/Kam0ciZfrhO8XivyMo8Ezyxjf7KIXSWoW8o=; b=XSwUbqEoD14DXLi+TeoXIznyIeVvrIfPzda4s2en2uDYAxPo1lOgrRdn xL+OvMH2K2b9vgReQK+ex+ZUFAAmhJ5DeoTv/B+nxlfHdqYlLZRS8SMlS 91+TIEBMnlDRkNP944z+DAw6s5reQGxYe9aAWRMAChKKCtk0pUfSgOPqj QV9ZK3aud1iz1akRyi9JZbw90zHZRDUqyxDdR3Hx3zj8OAo8ngzwAgEk9 CDb5TOQa9aA+R8kyY9LXzevdYs+dDi6fDbL05duqDtBbduKTtRtyZRfaF aV6PdtFq40n5KqX3/jWXLX30MTMjRFBG9O4/sHEp2L2wrtiIMyo18AnWi g==; X-IronPort-AV: E=McAfee;i="6500,9779,10509"; a="290580017" X-IronPort-AV: E=Sophos;i="5.95,207,1661842800"; d="scan'208";a="290580017" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Oct 2022 08:31:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10509"; a="876201892" X-IronPort-AV: E=Sophos;i="5.95,207,1661842800"; d="scan'208";a="876201892" Received: from chenyu-dev.sh.intel.com ([10.239.158.170]) by fmsmga006.fm.intel.com with ESMTP; 23 Oct 2022 08:31:42 -0700 From: Chen Yu To: Peter Zijlstra , Vincent Guittot , Tim Chen , Mel Gorman Cc: Juri Lelli , Rik van Riel , Aaron Lu , Abel Wu , K Prateek Nayak , Yicong Yang , "Gautham R . Shenoy" , Ingo Molnar , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , Hillf Danton , Honglei Wang , Len Brown , Chen Yu , linux-kernel@vger.kernel.org, Chen Yu Subject: [RFC PATCH v2 0/2] sched/fair: Choose the CPU where short task is running during wake up Date: Sun, 23 Oct 2022 23:31:50 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 At LPC 2022 Real-time and Scheduling Micro Conference we presented the cross CPU wakeup issue. This patch is a text version of the talk, and hopefully, we can clarify the problem and appreciate any feedback. The main purpose of this change is to avoid too many crosses CPU wake up when the system is busy. Please refer to the commit log of [PATCH 2/2] for detail. This patch set is composed of two parts. The first part is to introduce the definition of a short-duration task. The second part leverages the first part to choose a CPU where only one short-duration task is running on. This CPU is chosen as the candidate to place a woken task. This version is modified based on the following feedback on v1: 1. Tim suggested raising the bar to choose a CPU with a short-duration task, by checking if the short-duration task is the only runnable task on the target CPU. 2. To address Peter's concern: would this patch inhibit spreading the workload when there are idle CPUs around? The patch would only take effect when the system is relatively busy, and only choose the CPU where only one short-duration task is running. 3. Prateek, Honglwei and Hillf suggsted to prefer previous idle CPU to the CPU with short-duration task running. v1 link: https://lore.kernel.org/lkml/20220915165407.1776363-1-yu.c.chen@intel.com/ Chen Yu (2): sched/fair: Introduce short duration task check sched/fair: Choose the CPU where short task is running during wake up include/linux/sched.h | 8 ++++ kernel/sched/core.c | 2 + kernel/sched/fair.c | 99 +++++++++++++++++++++++++++++++++++++++++ kernel/sched/features.h | 1 + 4 files changed, 110 insertions(+) -- 2.25.1