Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1758092pxb; Thu, 4 Nov 2021 07:58:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4Z6hmkKsfB/9XOTGY/MneG9Po462ZUkFnedf2vyqI0XjR7w6I0ERoiOWAWwe32kqVeRTh X-Received: by 2002:a5d:9d8a:: with SMTP id ay10mr24555768iob.138.1636037932008; Thu, 04 Nov 2021 07:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636037932; cv=none; d=google.com; s=arc-20160816; b=nLRcd0CCgyTEa8MDQGSkflb25bwZfxqbfpnaGEXelcn7U5lppW7ZWedHV3db8oEazk G3bPwV8n3y36LF9xtcSSGyTchkYXXyTamfiMGsWbes8yAV7pYinm4v54d4tRH8Bbj3Wx cCoqHrYvIhxRFuowVdV8WaC0VFL6s3ueUAqu3asaINCL9FC3AUp0iUIJNKk76JraGFsI 8IhVOKW+ySQdAPOtI1lmxjCZ2VjlWBovKnn5YYQoJNb5q6nHggczI+3pljlaCdyUJ15Z 6ngGZzYW1qJIT1VCXlmdiTsXZu59vm7VZZhBxN0RGNTjAPnl3fmaohf1eHB+hiI623CZ iddQ== 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=OLcGDASkjqFAh2jkBmW+ReuKGptu7lZrBI/eCgVS/l0=; b=rAOUZTlS6Xj6Jiav8TpS4PEm+iOY28hnCSxuXd/8kcRLVQrCoN+2WoMRsKNRr33QpE NqZHhJ1l40qcqZKpLJbSbflif1ijxyk2f7xVloy+uVn0Kb7sSNataojYrzdpIdq5nUj+ sLF5Wv/VnhUXkEccB12AisicnoMMHT/LwMIXLX2uXgqmi41NPRkhuB7ZHu2VCUdBERyb OK4H8XSQKQlsHK4KFrkBtUIXfcrQNR+2rb7HOZprWOtLakCnOhPMvAO2FqRh0ZAHPqrU 7/CMwNKS035roIj8BqTkMlYekrIjuaGWHfxr6ELgrcr6Fl7jJ9RGlbvfPG/EiPOxUCRA ppGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qAPEjfsy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si7971834ils.144.2021.11.04.07.58.38; Thu, 04 Nov 2021 07:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qAPEjfsy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbhKDPAM (ORCPT + 99 others); Thu, 4 Nov 2021 11:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbhKDPAL (ORCPT ); Thu, 4 Nov 2021 11:00:11 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67215C061714 for ; Thu, 4 Nov 2021 07:57:33 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id u17so7609177plg.9 for ; Thu, 04 Nov 2021 07:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OLcGDASkjqFAh2jkBmW+ReuKGptu7lZrBI/eCgVS/l0=; b=qAPEjfsyM+A/dv9FnCwRZ6j7b3t5bRWP0QKxRmqmaZoQ9oCcRMF0SiehXSNSFPaBKy N4s00SGKBb8Pbt2uK+5EXBVT/0IDYTE09OpE/LVacpFedTQAR4mz8EzeE20+C5fhiZsK wOyIShDDpJ+JtE4LPnqEteJua5SjNRN5qI36AhG+Va/J4t8TQGCfU3CJ7CMFUvaNGZqo mewtloZdmN9CAck5VgmrJJYjzNggo2HQ0xt7opFlymCECBZ3nYKGsshXXGcqvbt9IHec he7gfmAbOxKZRSqXzCsLEAFf9eW83JkCaXkJf+fk6uuiD2z4yk43ERvoLgWPDf3EsCtp rQsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OLcGDASkjqFAh2jkBmW+ReuKGptu7lZrBI/eCgVS/l0=; b=PKzIDVWy1u0nIcB3ErFoqTtUwCxmWPMT7RW9Lvv5HLWuo+99IQtHNtO09G4YlOnGz/ VcEPIIesJCsjAxKl04aSPM+SSrcbjebx2fab86A1838KMaQI/zNwMJ6HTMVkewF2H3Ez +B2eFvewBOpd363hJVS9xMu3whL5V7F0fABDPPY09/pmpW8pZibV9U1/GVK//nQo6o4h aEjEv4TnAGaWOfsmi6332ie1vOFgjGruOI+pFPU+l5AwTRZf2+3FqJhu0eNqxq3AiHLC PVVqUJfeny8Hg4VLjiVeRQLkkA6qGIIbrYNSxlb1yHQkO/QALQa3McaBzClB/RfaQB37 yXqQ== X-Gm-Message-State: AOAM530xXwhPwJuHxSv4n7JBWGxVcYkHuxqpX3HYsE4k2Uew2brGLRpy 7a83DIqmjU7n8smAtir+Cz4= X-Received: by 2002:a17:90a:ae18:: with SMTP id t24mr22687446pjq.92.1636037852935; Thu, 04 Nov 2021 07:57:32 -0700 (PDT) Received: from localhost.localdomain ([140.82.17.67]) by smtp.gmail.com with ESMTPSA id t8sm4328530pgk.66.2021.11.04.07.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:57:32 -0700 (PDT) From: Yafang Shao To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com Cc: linux-kernel@vger.kernel.org, Yafang Shao Subject: [RFC PATCH 0/4] sched: Introduce cfs_migration Date: Thu, 4 Nov 2021 14:57:09 +0000 Message-Id: <20211104145713.4419-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The active load balance has a known issue[1][2] that there is a race window between waking up the migration thread on the busiest CPU and it begins to preempt the current running CFS task. This race window may cause unexpected behavior that the current running CFS task may be preempted by a RT task first, and then the RT task will be preempted by this waked migration thread. Per our tracing, the latency caused by this preemption can be greater than 1ms, which is not a small latency for the RT tasks. We'd better set a proper priority to this balance work so that it can preempt CFS task only. A new per-cpu thread cfs_migration is introduced for this purpose. The cfs_migration thread has a priority FIFO-1, which means it can preempt any cfs tasks but can't preempt other FIFO tasks. Besides the active load balance work, the numa balance work also applies to CFS tasks only. So we'd better assign cfs_migraion to numa balance work as well. [1]. https://lore.kernel.org/lkml/CAKfTPtBygNcVewbb0GQOP5xxO96am3YeTZNP5dK9BxKHJJAL-g@mail.gmail.com/ [2]. https://lore.kernel.org/lkml/20210615121551.31138-1-laoar.shao@gmail.com/ Yafang Shao (4): stop_machine: Move cpu_stop_done into stop_machine.h sched/fair: Introduce cfs_migration sched/fair: Do active load balance in cfs_migration sched/core: Do numa balance in cfs_migration include/linux/stop_machine.h | 12 +++ kernel/sched/core.c | 2 +- kernel/sched/fair.c | 143 ++++++++++++++++++++++++++++++++++- kernel/sched/sched.h | 2 + kernel/stop_machine.c | 14 +--- 5 files changed, 158 insertions(+), 15 deletions(-) -- 2.17.1