Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-24 Thread Peter Zijlstra
On Thu, Jan 24, 2019 at 11:21:53AM +, Patrick Bellasi wrote: > When a task-specific uclamp value is changed for a task, instead, a > dequeue/enqueue is not needed. As long as we are doing a lazy update, > that sounds just like not necessary overhead. When that overhead is shown to be a proble

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-24 Thread Patrick Bellasi
On 23-Jan 19:59, Peter Zijlstra wrote: > On Wed, Jan 23, 2019 at 02:14:26PM +, Patrick Bellasi wrote: > > > > > Consider also that the uclamp_task_update_active() added by this patch > > > > not only has lower overhead but it will be use also by cgroups where > > > > we want to force update al

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-23 Thread Peter Zijlstra
On Wed, Jan 23, 2019 at 02:14:26PM +, Patrick Bellasi wrote: > > > Consider also that the uclamp_task_update_active() added by this patch > > > not only has lower overhead but it will be use also by cgroups where > > > we want to force update all the tasks on a cgroup's clamp change. > > > >

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-23 Thread Patrick Bellasi
On 23-Jan 10:16, Peter Zijlstra wrote: > On Tue, Jan 22, 2019 at 03:33:15PM +, Patrick Bellasi wrote: > > On 22-Jan 15:57, Peter Zijlstra wrote: > > > On Tue, Jan 22, 2019 at 02:01:15PM +, Patrick Bellasi wrote: > > > > > Yes, I would say we have two options: > > > > > > > > 1) SCHED_FLA

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-23 Thread Peter Zijlstra
On Tue, Jan 22, 2019 at 03:33:15PM +, Patrick Bellasi wrote: > On 22-Jan 15:57, Peter Zijlstra wrote: > > On Tue, Jan 22, 2019 at 02:01:15PM +, Patrick Bellasi wrote: > > > Yes, I would say we have two options: > > > > > > 1) SCHED_FLAG_KEEP_POLICY enforces all the scheduling class speci

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Patrick Bellasi
On 22-Jan 15:57, Peter Zijlstra wrote: > On Tue, Jan 22, 2019 at 02:01:15PM +, Patrick Bellasi wrote: > > On 22-Jan 14:28, Peter Zijlstra wrote: > > > On Tue, Jan 22, 2019 at 10:43:05AM +, Patrick Bellasi wrote: > > > > On 22-Jan 10:37, Peter Zijlstra wrote: > > > > > > > > Sure, I get tha

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Peter Zijlstra
On Tue, Jan 22, 2019 at 02:01:15PM +, Patrick Bellasi wrote: > On 22-Jan 14:28, Peter Zijlstra wrote: > > On Tue, Jan 22, 2019 at 10:43:05AM +, Patrick Bellasi wrote: > > > On 22-Jan 10:37, Peter Zijlstra wrote: > > > > > > Sure, I get that. What I don't get is why you're adding that (2) h

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Patrick Bellasi
On 22-Jan 14:28, Peter Zijlstra wrote: > On Tue, Jan 22, 2019 at 10:43:05AM +, Patrick Bellasi wrote: > > On 22-Jan 10:37, Peter Zijlstra wrote: > > > > Sure, I get that. What I don't get is why you're adding that (2) here. > > > Like said, __sched_setscheduler() already does a dequeue/enqueue

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Peter Zijlstra
On Tue, Jan 22, 2019 at 10:43:05AM +, Patrick Bellasi wrote: > On 22-Jan 10:37, Peter Zijlstra wrote: > > Sure, I get that. What I don't get is why you're adding that (2) here. > > Like said, __sched_setscheduler() already does a dequeue/enqueue under > > rq->lock, which should already take ca

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Patrick Bellasi
On 22-Jan 10:37, Peter Zijlstra wrote: > On Mon, Jan 21, 2019 at 03:44:12PM +, Patrick Bellasi wrote: > > On 21-Jan 16:33, Peter Zijlstra wrote: > > > On Tue, Jan 15, 2019 at 10:15:02AM +, Patrick Bellasi wrote: > > > > > > > +static inline void > > > > +uclamp_task_update_active(struct ta

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Peter Zijlstra
On Mon, Jan 21, 2019 at 03:44:12PM +, Patrick Bellasi wrote: > On 21-Jan 16:33, Peter Zijlstra wrote: > > On Tue, Jan 15, 2019 at 10:15:02AM +, Patrick Bellasi wrote: > > > > > +static inline void > > > +uclamp_task_update_active(struct task_struct *p, unsigned int clamp_id) > > > +{ > > >

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-21 Thread Patrick Bellasi
On 21-Jan 16:33, Peter Zijlstra wrote: > On Tue, Jan 15, 2019 at 10:15:02AM +, Patrick Bellasi wrote: > > > +static inline void > > +uclamp_task_update_active(struct task_struct *p, unsigned int clamp_id) > > +{ > > + struct rq_flags rf; > > + struct rq *rq; > > + > > + /* > > +* Loc

Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-21 Thread Peter Zijlstra
On Tue, Jan 15, 2019 at 10:15:02AM +, Patrick Bellasi wrote: > +static inline void > +uclamp_task_update_active(struct task_struct *p, unsigned int clamp_id) > +{ > + struct rq_flags rf; > + struct rq *rq; > + > + /* > + * Lock the task and the CPU where the task is (or was) q

[PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-15 Thread Patrick Bellasi
Utilization clamp values enforced on a CPU by a task can be updated, for example via a sched_setattr() syscall, while a task is RUNNABLE on that CPU. A clamp value change always implies a clamp bucket refcount update to ensure the new constraints are enforced. Hook into uclamp_bucket_get() to trig