Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1604923pxb; Thu, 4 Mar 2021 16:07:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJweSj1lIt1otmUiYn/hkE3Viw6DfSK2Q46Sh9CPCaVJ9r92UK6KHDGYsmAFbQtZmSID6lUZ X-Received: by 2002:a05:6602:99:: with SMTP id h25mr5451302iob.168.1614902845065; Thu, 04 Mar 2021 16:07:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614902845; cv=none; d=google.com; s=arc-20160816; b=NKlwf7nCVgxVV+cB+YR8Svd2Cg8zhPHFtoxv6GGP0adLXGHPZcNWmPVJR+okyqGNdp MYIEK5J32rCejfed2vqrf9rSlcxoNpKdGGRLLIx2eo0iw5sqmRkkNDU1iOlFPYloSoZA sKZwUPxIRJcuuU+ZwkD4W2qe1DTDbzYdvDEZjeMlmfE/oH95qYhGn9Yd61B/mxvoTDIC ijfO4VAH0ChZw6mLC0041DYrJ4kgN5qvLBOVt/3mt1n72eoYjAv9KJHEcw9CH4GY+aC/ UqlCJE8goHN71cLEIaI+AGqIKtzBCkiy2XXr3vwXSrizHPo+iKfCpHDvNdA6kFBpReAQ axuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=10ccOh8vOUbODUq+iULbAEv81TLKMCdFV5pnX2/1ZRk=; b=cWGx3x3R0D6OkRDHnPszgLSZRfOPjFXCTkPXc/gdf95AHdFFXlcnOcDqwqTbpO7Sk9 I8r05ERMmHIzsSVnOFgSMxAO9w2kRYzKqGp3NUBZpx2TIS5HK7IceNG7wP1BbWfmhiyR HmzLhtMFS+Aj4bJo34XuCd+w0787B9kePZfld9CcmoXwRPz1Osidpovu7tvjyGBy9vea 3FmGnRTcuhUs1BkT53tGm0XYH0GoiPUeyhKiAAbL3jAoNz8IQ8lY0pom5iYBDWHrdK8G TP7d6ZweDzFdlFHLUppg18sPpQhpl6xcpscWW8fxd0qV6+l229fxs4NWGwH491oa+j5w 6FFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AVeZQQtq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=vOgnwfPK; 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=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si884337jaj.57.2021.03.04.16.07.10; Thu, 04 Mar 2021 16:07:25 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=AVeZQQtq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=vOgnwfPK; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234643AbhCDJKV (ORCPT + 99 others); Thu, 4 Mar 2021 04:10:21 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:48346 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231235AbhCDJJy (ORCPT ); Thu, 4 Mar 2021 04:09:54 -0500 Date: Thu, 04 Mar 2021 09:09:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1614848953; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=10ccOh8vOUbODUq+iULbAEv81TLKMCdFV5pnX2/1ZRk=; b=AVeZQQtqi5oUg1LNGat/edunnKDIei0RNWCuFRzZlXhqpGOImQ+K7YdggBrxpJefI6rE4k CMqUHpemzmyfoTjC1E+LM/K+bJ/Xz4BZ0iE94cz2JA3pcOb7t3ijtgPdWeace+yb3yUMwd Hue+hN8bhz/rVPFXlSO+l1wec8obm0Vd8yxxlOX3e6RbK6qnX0QTC/yyL/aDj8XnG205DS Hu1jL5v2cWSxjZagxYzIl0vuitdbyMmhaTeUOcoc5rKP8/Gia8Nhx82NPv8UQ7TEY9qBm7 DAekAmbanPzKem+A+EaFc0zFC1gP+vEHRD+hx2+dbmPtKtI07HLJVHMfQVhnIQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1614848953; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=10ccOh8vOUbODUq+iULbAEv81TLKMCdFV5pnX2/1ZRk=; b=vOgnwfPK59hDKdbrdfK5HduMPosensKyyn2kA2KVEsMMEXGT1t7uwEzG0nuyTtP1y7QtuW kFp92gBKW5GpD9Dg== From: "tip-bot2 for Chengming Zhou" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] psi: Add PSI_CPU_FULL state Cc: Muchun Song , Chengming Zhou , "Peter Zijlstra (Intel)" , Johannes Weiner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210303034659.91735-2-zhouchengming@bytedance.com> References: <20210303034659.91735-2-zhouchengming@bytedance.com> MIME-Version: 1.0 Message-ID: <161484895253.398.14987019739451674581.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 311b293811a31929c72c790eff48cf767561589f Gitweb: https://git.kernel.org/tip/311b293811a31929c72c790eff48cf767561589f Author: Chengming Zhou AuthorDate: Wed, 03 Mar 2021 11:46:56 +08:00 Committer: Peter Zijlstra CommitterDate: Thu, 04 Mar 2021 09:56:01 +01:00 psi: Add PSI_CPU_FULL state The FULL state doesn't exist for the CPU resource at the system level, but exist at the cgroup level, means all non-idle tasks in a cgroup are delayed on the CPU resource which used by others outside of the cgroup or throttled by the cgroup cpu.max configuration. Co-developed-by: Muchun Song Signed-off-by: Muchun Song Signed-off-by: Chengming Zhou Signed-off-by: Peter Zijlstra (Intel) Acked-by: Johannes Weiner Link: https://lkml.kernel.org/r/20210303034659.91735-2-zhouchengming@bytedance.com --- include/linux/psi_types.h | 3 ++- kernel/sched/psi.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h index b95f321..0a23300 100644 --- a/include/linux/psi_types.h +++ b/include/linux/psi_types.h @@ -50,9 +50,10 @@ enum psi_states { PSI_MEM_SOME, PSI_MEM_FULL, PSI_CPU_SOME, + PSI_CPU_FULL, /* Only per-CPU, to weigh the CPU in the global average: */ PSI_NONIDLE, - NR_PSI_STATES = 6, + NR_PSI_STATES = 7, }; enum psi_aggregators { diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 967732c..2293c45 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -34,7 +34,10 @@ * delayed on that resource such that nobody is advancing and the CPU * goes idle. This leaves both workload and CPU unproductive. * - * (Naturally, the FULL state doesn't exist for the CPU resource.) + * Naturally, the FULL state doesn't exist for the CPU resource at the + * system level, but exist at the cgroup level, means all non-idle tasks + * in a cgroup are delayed on the CPU resource which used by others outside + * of the cgroup or throttled by the cgroup cpu.max configuration. * * SOME = nr_delayed_tasks != 0 * FULL = nr_delayed_tasks != 0 && nr_running_tasks == 0 @@ -225,6 +228,8 @@ static bool test_state(unsigned int *tasks, enum psi_states state) return tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]; case PSI_CPU_SOME: return tasks[NR_RUNNING] > tasks[NR_ONCPU]; + case PSI_CPU_FULL: + return tasks[NR_RUNNING] && !tasks[NR_ONCPU]; case PSI_NONIDLE: return tasks[NR_IOWAIT] || tasks[NR_MEMSTALL] || tasks[NR_RUNNING]; @@ -678,8 +683,11 @@ static void record_times(struct psi_group_cpu *groupc, int cpu, } } - if (groupc->state_mask & (1 << PSI_CPU_SOME)) + if (groupc->state_mask & (1 << PSI_CPU_SOME)) { groupc->times[PSI_CPU_SOME] += delta; + if (groupc->state_mask & (1 << PSI_CPU_FULL)) + groupc->times[PSI_CPU_FULL] += delta; + } if (groupc->state_mask & (1 << PSI_NONIDLE)) groupc->times[PSI_NONIDLE] += delta; @@ -1018,7 +1026,7 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res) group->avg_next_update = update_averages(group, now); mutex_unlock(&group->avgs_lock); - for (full = 0; full < 2 - (res == PSI_CPU); full++) { + for (full = 0; full < 2; full++) { unsigned long avg[3]; u64 total; int w;