mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	sched: Move uclamp_util sysctls to core.c
move uclamp_util sysctls to core.c and use the new register_sysctl_init() to register the sysctl interface. Signed-off-by: Zhen Ni <nizhen@uniontech.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
This commit is contained in:
		
							parent
							
								
									28f152cd09
								
							
						
					
					
						commit
						3267e0156c
					
				
					 3 changed files with 37 additions and 42 deletions
				
			
		| 
						 | 
					@ -31,18 +31,10 @@ extern int sysctl_numa_balancing_mode;
 | 
				
			||||||
#define sysctl_numa_balancing_mode	0
 | 
					#define sysctl_numa_balancing_mode	0
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_UCLAMP_TASK
 | 
					 | 
				
			||||||
extern unsigned int sysctl_sched_uclamp_util_min;
 | 
					 | 
				
			||||||
extern unsigned int sysctl_sched_uclamp_util_max;
 | 
					 | 
				
			||||||
extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef CONFIG_CFS_BANDWIDTH
 | 
					#ifdef CONFIG_CFS_BANDWIDTH
 | 
				
			||||||
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
 | 
					extern unsigned int sysctl_sched_cfs_bandwidth_slice;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
 | 
					 | 
				
			||||||
		void *buffer, size_t *lenp, loff_t *ppos);
 | 
					 | 
				
			||||||
int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
 | 
					int sysctl_numa_balancing(struct ctl_table *table, int write, void *buffer,
 | 
				
			||||||
		size_t *lenp, loff_t *ppos);
 | 
							size_t *lenp, loff_t *ppos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1306,10 +1306,10 @@ static void set_load_weight(struct task_struct *p, bool update_load)
 | 
				
			||||||
static DEFINE_MUTEX(uclamp_mutex);
 | 
					static DEFINE_MUTEX(uclamp_mutex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Max allowed minimum utilization */
 | 
					/* Max allowed minimum utilization */
 | 
				
			||||||
unsigned int sysctl_sched_uclamp_util_min = SCHED_CAPACITY_SCALE;
 | 
					static unsigned int sysctl_sched_uclamp_util_min = SCHED_CAPACITY_SCALE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Max allowed maximum utilization */
 | 
					/* Max allowed maximum utilization */
 | 
				
			||||||
unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
 | 
					static unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * By default RT tasks run at the maximum performance point/capacity of the
 | 
					 * By default RT tasks run at the maximum performance point/capacity of the
 | 
				
			||||||
| 
						 | 
					@ -1326,7 +1326,7 @@ unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
 | 
				
			||||||
 * This knob will not override the system default sched_util_clamp_min defined
 | 
					 * This knob will not override the system default sched_util_clamp_min defined
 | 
				
			||||||
 * above.
 | 
					 * above.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
unsigned int sysctl_sched_uclamp_util_min_rt_default = SCHED_CAPACITY_SCALE;
 | 
					static unsigned int sysctl_sched_uclamp_util_min_rt_default = SCHED_CAPACITY_SCALE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* All clamps are required to be less or equal than these values */
 | 
					/* All clamps are required to be less or equal than these values */
 | 
				
			||||||
static struct uclamp_se uclamp_default[UCLAMP_CNT];
 | 
					static struct uclamp_se uclamp_default[UCLAMP_CNT];
 | 
				
			||||||
| 
						 | 
					@ -1779,7 +1779,7 @@ static void uclamp_update_root_tg(void)
 | 
				
			||||||
static void uclamp_update_root_tg(void) { }
 | 
					static void uclamp_update_root_tg(void) { }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
 | 
					static int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
 | 
				
			||||||
				void *buffer, size_t *lenp, loff_t *ppos)
 | 
									void *buffer, size_t *lenp, loff_t *ppos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	bool update_root_tg = false;
 | 
						bool update_root_tg = false;
 | 
				
			||||||
| 
						 | 
					@ -4436,8 +4436,12 @@ static int sysctl_schedstats(struct ctl_table *table, int write, void *buffer,
 | 
				
			||||||
		set_schedstats(state);
 | 
							set_schedstats(state);
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#endif /* CONFIG_PROC_SYSCTL */
 | 
				
			||||||
 | 
					#endif /* CONFIG_SCHEDSTATS */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct ctl_table sched_schedstats_sysctls[] = {
 | 
					#ifdef CONFIG_SYSCTL
 | 
				
			||||||
 | 
					static struct ctl_table sched_core_sysctls[] = {
 | 
				
			||||||
 | 
					#ifdef CONFIG_SCHEDSTATS
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		.procname       = "sched_schedstats",
 | 
							.procname       = "sched_schedstats",
 | 
				
			||||||
		.data           = NULL,
 | 
							.data           = NULL,
 | 
				
			||||||
| 
						 | 
					@ -4447,17 +4451,39 @@ static struct ctl_table sched_schedstats_sysctls[] = {
 | 
				
			||||||
		.extra1         = SYSCTL_ZERO,
 | 
							.extra1         = SYSCTL_ZERO,
 | 
				
			||||||
		.extra2         = SYSCTL_ONE,
 | 
							.extra2         = SYSCTL_ONE,
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					#endif /* CONFIG_SCHEDSTATS */
 | 
				
			||||||
 | 
					#ifdef CONFIG_UCLAMP_TASK
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							.procname       = "sched_util_clamp_min",
 | 
				
			||||||
 | 
							.data           = &sysctl_sched_uclamp_util_min,
 | 
				
			||||||
 | 
							.maxlen         = sizeof(unsigned int),
 | 
				
			||||||
 | 
							.mode           = 0644,
 | 
				
			||||||
 | 
							.proc_handler   = sysctl_sched_uclamp_handler,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							.procname       = "sched_util_clamp_max",
 | 
				
			||||||
 | 
							.data           = &sysctl_sched_uclamp_util_max,
 | 
				
			||||||
 | 
							.maxlen         = sizeof(unsigned int),
 | 
				
			||||||
 | 
							.mode           = 0644,
 | 
				
			||||||
 | 
							.proc_handler   = sysctl_sched_uclamp_handler,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							.procname       = "sched_util_clamp_min_rt_default",
 | 
				
			||||||
 | 
							.data           = &sysctl_sched_uclamp_util_min_rt_default,
 | 
				
			||||||
 | 
							.maxlen         = sizeof(unsigned int),
 | 
				
			||||||
 | 
							.mode           = 0644,
 | 
				
			||||||
 | 
							.proc_handler   = sysctl_sched_uclamp_handler,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					#endif /* CONFIG_UCLAMP_TASK */
 | 
				
			||||||
	{}
 | 
						{}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					static int __init sched_core_sysctl_init(void)
 | 
				
			||||||
static int __init sched_schedstats_sysctl_init(void)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	register_sysctl_init("kernel", sched_schedstats_sysctls);
 | 
						register_sysctl_init("kernel", sched_core_sysctls);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
late_initcall(sched_schedstats_sysctl_init);
 | 
					late_initcall(sched_core_sysctl_init);
 | 
				
			||||||
#endif /* CONFIG_PROC_SYSCTL */
 | 
					#endif /* CONFIG_SYSCTL */
 | 
				
			||||||
#endif /* CONFIG_SCHEDSTATS */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * fork()/clone()-time setup:
 | 
					 * fork()/clone()-time setup:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1681,29 +1681,6 @@ static struct ctl_table kern_table[] = {
 | 
				
			||||||
		.extra2		= SYSCTL_FOUR,
 | 
							.extra2		= SYSCTL_FOUR,
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
#endif /* CONFIG_NUMA_BALANCING */
 | 
					#endif /* CONFIG_NUMA_BALANCING */
 | 
				
			||||||
#ifdef CONFIG_UCLAMP_TASK
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		.procname	= "sched_util_clamp_min",
 | 
					 | 
				
			||||||
		.data		= &sysctl_sched_uclamp_util_min,
 | 
					 | 
				
			||||||
		.maxlen		= sizeof(unsigned int),
 | 
					 | 
				
			||||||
		.mode		= 0644,
 | 
					 | 
				
			||||||
		.proc_handler	= sysctl_sched_uclamp_handler,
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		.procname	= "sched_util_clamp_max",
 | 
					 | 
				
			||||||
		.data		= &sysctl_sched_uclamp_util_max,
 | 
					 | 
				
			||||||
		.maxlen		= sizeof(unsigned int),
 | 
					 | 
				
			||||||
		.mode		= 0644,
 | 
					 | 
				
			||||||
		.proc_handler	= sysctl_sched_uclamp_handler,
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		.procname	= "sched_util_clamp_min_rt_default",
 | 
					 | 
				
			||||||
		.data		= &sysctl_sched_uclamp_util_min_rt_default,
 | 
					 | 
				
			||||||
		.maxlen		= sizeof(unsigned int),
 | 
					 | 
				
			||||||
		.mode		= 0644,
 | 
					 | 
				
			||||||
		.proc_handler	= sysctl_sched_uclamp_handler,
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#ifdef CONFIG_CFS_BANDWIDTH
 | 
					#ifdef CONFIG_CFS_BANDWIDTH
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		.procname	= "sched_cfs_bandwidth_slice_us",
 | 
							.procname	= "sched_cfs_bandwidth_slice_us",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue