Re: [RFC PATCH v3 00/16] Core scheduling v3

From: Tim Chen
Date: Thu Aug 08 2019 - 13:27:23 EST


On 8/7/19 11:47 PM, Aaron Lu wrote:
> On Tue, Aug 06, 2019 at 02:19:57PM -0700, Tim Chen wrote:
>> +void account_core_idletime(struct task_struct *p, u64 exec)
>> +{
>> + const struct cpumask *smt_mask;
>> + struct rq *rq;
>> + bool force_idle, refill;
>> + int i, cpu;
>> +
>> + rq = task_rq(p);
>> + if (!sched_core_enabled(rq) || !p->core_cookie)
>> + return;
>
> I don't see why return here for untagged task. Untagged task can also
> preempt tagged task and force a CPU thread enter idle state.
> Untagged is just another tag to me, unless we want to allow untagged
> task to coschedule with a tagged task.

You are right. This needs to be fixed.

And the cookie check will also need to be changed in prio_less_fair.

@@ -611,6 +611,17 @@ bool prio_less_fair(struct task_struct *a, struct task_struct *b)
* Normalize the vruntime if tasks are in different cpus.
*/
if (task_cpu(a) != task_cpu(b)) {
+
+ if (a->core_cookie && b->core_cookie &&
+ a->core_cookie != b->core_cookie) {

if (!cookie_match(a, b))

+ /*
+ * Will be force idling one thread,
+ * pick the thread that has more allowance.
+ */
+ return (task_rq(a)->core_idle_allowance <=
+ task_rq(b)->core_idle_allowance) ? true : false;
+ }
+

I'll respin my patches.

Tim