Re: [PATCH 24/32] Task fork and exit for rdtgroup

From: Thomas Gleixner
Date: Wed Jul 13 2016 - 09:17:31 EST


On Tue, 12 Jul 2016, Fenghua Yu wrote:
> +void rdtgroup_fork(struct task_struct *child)
> +{
> + INIT_LIST_HEAD(&child->rg_list);
> + child->rdtgroup = NULL;
> +}
> +
> +void rdtgroup_post_fork(struct task_struct *child)
> +{
> + if (!use_rdtgroup_tasks)
> + return;
> +
> + spin_lock_irq(&rdtgroup_task_lock);
> + if (list_empty(&child->rg_list)) {

Why would the list be non empty after a fork?

> + struct rdtgroup *rdtgrp = current->rdtgroup;
> +
> + list_add_tail(&child->rg_list, &rdtgrp->pset.tasks);
> + child->rdtgroup = rdtgrp;
> + atomic_inc(&rdtgrp->pset.refcount);
> + }
> + spin_unlock_irq(&rdtgroup_task_lock);
> +}
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 9e6e135..04346b6 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -59,6 +59,7 @@
> #include <asm/unistd.h>
> #include <asm/pgtable.h>
> #include <asm/mmu_context.h>
> +#include <asm/intel_rdt.h>
>
> static void __unhash_process(struct task_struct *p, bool group_dead)
> {
> @@ -757,6 +758,7 @@ void do_exit(long code)
> perf_event_exit_task(tsk);
>
> cgroup_exit(tsk);
> + rdtgroup_exit(tsk);

-ENOSUCHFUNCTION

Please provide the implementations first and then hook it up not the other way
round.

Thanks,

tglx