From: Daniel Bristot de Oliveira <bristot@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>,
Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org,
Luca Abeni <luca.abeni@santannapisa.it>,
Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
Thomas Gleixner <tglx@linutronix.de>,
Joel Fernandes <joel@joelfernandes.org>,
Vineeth Pillai <vineeth@bitbyteword.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Phil Auld <pauld@redhat.com>
Subject: Re: [PATCH v4 7/7] sched/fair: Fair server interface
Date: Tue, 5 Sep 2023 18:17:26 +0200 [thread overview]
Message-ID: <ee0ac345-e3b0-52ea-d70e-0048b2296e67@redhat.com> (raw)
In-Reply-To: <20230905135500.GB20703@noisy.programming.kicks-ass.net>
On 9/5/23 15:55, Peter Zijlstra wrote:
> On Thu, Aug 31, 2023 at 10:28:58PM +0200, Daniel Bristot de Oliveira wrote:
>> +static ssize_t
>> +sched_fair_server_runtime_write(struct file *filp, const char __user *ubuf,
>> + size_t cnt, loff_t *ppos)
>> +{
>> + long cpu = (long) ((struct seq_file *) filp->private_data)->private;
>> + struct rq *rq = cpu_rq(cpu);
>> + unsigned long flags;
>> + u64 runtime;
>> + int err;
>> +
>> + err = kstrtoull_from_user(ubuf, cnt, 10, &runtime);
>> + if (err)
>> + return err;
>> +
>> + raw_spin_rq_lock_irqsave(rq, flags);
>> + if (runtime > rq->fair_server.dl_period)
>> + err = -EINVAL;
>> + else
>> + rq->fair_server.dl_runtime = runtime;
>> + raw_spin_rq_unlock_irqrestore(rq, flags);
>> +
>> + if (err)
>> + return err;
>> +
>> + *ppos += cnt;
>> + return cnt;
>> +}
>
>> +static ssize_t
>> +sched_fair_server_period_write(struct file *filp, const char __user *ubuf,
>> + size_t cnt, loff_t *ppos)
>> +{
>> + long cpu = (long) ((struct seq_file *) filp->private_data)->private;
>> + struct rq *rq = cpu_rq(cpu);
>> + unsigned long flags;
>> + u64 period;
>> + int err;
>> +
>> + err = kstrtoull_from_user(ubuf, cnt, 10, &period);
>> + if (err)
>> + return err;
>> +
>> + if (period < fair_server_period_min || period > fair_server_period_max)
>> + return -EINVAL;
>> +
>> + raw_spin_rq_lock_irqsave(rq, flags);
>> + if (period < rq->fair_server.dl_runtime)
>> + err = -EINVAL;
>> + else
>> + rq->fair_server.dl_period = period;
>> + raw_spin_rq_unlock_irqrestore(rq, flags);
>> +
>> + if (err)
>> + return err;
>> +
>> + *ppos += cnt;
>> + return cnt;
>> +}
>
>> +static ssize_t
>> +sched_fair_server_defer_write(struct file *filp, const char __user *ubuf,
>> + size_t cnt, loff_t *ppos)
>> +{
>> + long cpu = (long) ((struct seq_file *) filp->private_data)->private;
>> + struct rq *rq = cpu_rq(cpu);
>> + unsigned long flags;
>> + u64 defer;
>> + int err;
>> +
>> + err = kstrtoull_from_user(ubuf, cnt, 10, &defer);
>> + if (err)
>> + return err;
>> +
>> + if (defer < 0 || defer > 1)
>> + return -EINVAL;
>> +
>> + raw_spin_rq_lock_irqsave(rq, flags);
>> + rq->fair_server_defer = defer;
>> + raw_spin_rq_unlock_irqrestore(rq, flags);
>> +
>> + *ppos += cnt;
>> + return cnt;
>> +}
>
> Surely we can write a single function that does all of that with less
> duplication?
I agree, I will use your code as starting point for that...
>
> Additionally, should not the deadline parameters be vetted by access
> control before being accepted ?
like security_task_getscheduler(p)? But we have no p...
I checked rt throttling, but it seems that it does not check. Do you have
a pointer?
-- Daniel
next prev parent reply other threads:[~2023-09-05 17:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 20:28 [PATCH v4 0/7] SCHED_DEADLINE server infrastructure Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 1/7] sched: Unify runtime accounting across classes Daniel Bristot de Oliveira
2023-09-15 21:41 ` Steven Rostedt
2023-08-31 20:28 ` [PATCH v4 2/7] sched/deadline: Collect sched_dl_entity initialization Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 3/7] sched/deadline: Move bandwidth accounting into {en,de}queue_dl_entity Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 4/7] sched/deadline: Introduce deadline servers Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 5/7] sched/fair: Add trivial fair server Daniel Bristot de Oliveira
2023-08-31 20:28 ` [PATCH v4 6/7] sched/deadline: Deferrable dl server Daniel Bristot de Oliveira
2023-09-05 13:42 ` Peter Zijlstra
2023-09-05 15:24 ` Daniel Bristot de Oliveira
2023-09-06 8:29 ` Peter Zijlstra
2023-09-06 14:58 ` Daniel Bristot de Oliveira
2023-09-06 20:04 ` Peter Zijlstra
2023-09-06 20:08 ` Peter Zijlstra
2023-09-08 14:14 ` Daniel Bristot de Oliveira
2023-09-08 13:59 ` Daniel Bristot de Oliveira
2023-09-07 8:07 ` Peter Zijlstra
2023-09-08 15:28 ` Daniel Bristot de Oliveira
2023-09-08 16:11 ` Peter Zijlstra
2023-08-31 20:28 ` [PATCH v4 7/7] sched/fair: Fair server interface Daniel Bristot de Oliveira
2023-09-01 2:01 ` kernel test robot
2023-09-05 13:55 ` Peter Zijlstra
2023-09-05 16:17 ` Daniel Bristot de Oliveira [this message]
2023-09-06 7:25 ` Peter Zijlstra
2023-09-06 8:25 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee0ac345-e3b0-52ea-d70e-0048b2296e67@redhat.com \
--to=bristot@redhat.com \
--cc=bristot@kernel.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=pauld@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=vincent.guittot@linaro.org \
--cc=vineeth@bitbyteword.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome