Commit 98bb91a3 authored by Chen Wandun's avatar Chen Wandun Committed by Lu Jialin
Browse files

mm: add config isolation for psi under cgroup v1

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8BCV4



-------------------------------

Add CONFIG_PSI_CGROUP_V1 to separate feature of psi under cgroup v1
from baseline.

Signed-off-by: default avatarChen Wandun <chenwandun@huawei.com>
Signed-off-by: default avatarLu Jialin <lujialin4@huawei.com>
parent c08228ed
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,7 +14,9 @@ struct css_set;
extern struct static_key_false psi_disabled;
extern struct psi_group psi_system;

#ifdef CONFIG_PSI_CGROUP_V1
extern struct static_key_true psi_v1_disabled;
#endif

void psi_init(void);

+10 −0
Original line number Diff line number Diff line
@@ -653,6 +653,16 @@ config PSI_DEFAULT_DISABLED

	  Say N if unsure.

config PSI_CGROUP_V1
       bool "Support PSI under cgroup v1"
       default n
       depends on PSI
       help
         If set, pressure stall information tracking will be used
         for cgroup v1 other than v2.

         Say N if unsure.

endmenu # "CPU/Task time and stats accounting"

config CPU_ISOLATION
+3 −0
Original line number Diff line number Diff line
@@ -3783,6 +3783,7 @@ static void cgroup_pressure_release(struct kernfs_open_file *of)
	psi_trigger_destroy(ctx->psi.trigger);
}

#ifdef CONFIG_PSI_CGROUP_V1
struct cftype cgroup_v1_psi_files[] = {
	{
		.name = "io.pressure",
@@ -3820,6 +3821,8 @@ struct cftype cgroup_v1_psi_files[] = {
#endif
	{ } /* terminate */
};
#endif

#endif /* CONFIG_PSI */

static int cgroup_freeze_show(struct seq_file *seq, void *v)
+1 −1
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
	.early_init	= true,
};

#ifdef CONFIG_PSI
#ifdef CONFIG_PSI_CGROUP_V1

static bool psi_v1_enable;
static int __init setup_psi_v1(char *str)
+14 −8
Original line number Diff line number Diff line
@@ -156,7 +156,10 @@
static int psi_bug __read_mostly;

DEFINE_STATIC_KEY_FALSE(psi_disabled);

#ifdef CONFIG_PSI_CGROUP_V1
DEFINE_STATIC_KEY_TRUE(psi_v1_disabled);
#endif

#ifdef CONFIG_PSI_DEFAULT_DISABLED
static bool psi_enable;
@@ -785,21 +788,23 @@ static struct psi_group *iterate_groups(struct task_struct *task, void **iter)
	struct cgroup *cgroup = NULL;

	if (!*iter) {
		if (static_branch_likely(&psi_v1_disabled))
#ifndef CONFIG_PSI_CGROUP_V1
		cgroup = task->cgroups->dfl_cgrp;
		else {
#else
#ifdef CONFIG_CGROUP_CPUACCT
		if (!cgroup_subsys_on_dfl(cpuacct_cgrp_subsys)) {
			if (!static_branch_likely(&psi_v1_disabled)) {
				rcu_read_lock();
				cgroup = task_cgroup(task, cpuacct_cgrp_id);
				rcu_read_unlock();
			}
		} else {
			cgroup = task->cgroups->dfl_cgrp;
		}
#else
		cgroup = NULL;
#endif
		}
#endif
	} else if (*iter == &psi_system)
		return NULL;
	else
@@ -1009,6 +1014,7 @@ void psi_memstall_leave(unsigned long *flags)
		return;

	trace_psi_memstall_leave(_RET_IP_);

	/*
	 * in_memstall clearing & accounting needs to be atomic wrt
	 * changes to the task's scheduling state, otherwise we could