|
@@ -436,18 +436,18 @@ int perf_proc_update_handler(struct ctl_table *table, int write,
|
|
|
void __user *buffer, size_t *lenp,
|
|
void __user *buffer, size_t *lenp,
|
|
|
loff_t *ppos)
|
|
loff_t *ppos)
|
|
|
{
|
|
{
|
|
|
- int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
|
|
|
|
-
|
|
|
|
|
- if (ret || !write)
|
|
|
|
|
- return ret;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ int ret;
|
|
|
|
|
+ int perf_cpu = sysctl_perf_cpu_time_max_percent;
|
|
|
/*
|
|
/*
|
|
|
* If throttling is disabled don't allow the write:
|
|
* If throttling is disabled don't allow the write:
|
|
|
*/
|
|
*/
|
|
|
- if (sysctl_perf_cpu_time_max_percent == 100 ||
|
|
|
|
|
- sysctl_perf_cpu_time_max_percent == 0)
|
|
|
|
|
|
|
+ if (write && (perf_cpu == 100 || perf_cpu == 0))
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
|
+ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
|
|
|
|
+ if (ret || !write)
|
|
|
|
|
+ return ret;
|
|
|
|
|
+
|
|
|
max_samples_per_tick = DIV_ROUND_UP(sysctl_perf_event_sample_rate, HZ);
|
|
max_samples_per_tick = DIV_ROUND_UP(sysctl_perf_event_sample_rate, HZ);
|
|
|
perf_sample_period_ns = NSEC_PER_SEC / sysctl_perf_event_sample_rate;
|
|
perf_sample_period_ns = NSEC_PER_SEC / sysctl_perf_event_sample_rate;
|
|
|
update_perf_cpu_limits();
|
|
update_perf_cpu_limits();
|