[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57D88800.1090302@intel.com>
Date: Tue, 13 Sep 2016 16:13:04 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Fenghua Yu <fenghua.yu@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <h.peter.anvin@...el.com>,
Ingo Molnar <mingo@...e.hu>, Tony Luck <tony.luck@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Tejun Heo <tj@...nel.org>, Borislav Petkov <bp@...e.de>,
Stephane Eranian <eranian@...gle.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
Shaohua Li <shli@...com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
Sai Prakhya <sai.praneeth.prakhya@...el.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v2 26/33] Task fork and exit for rdtgroup
On 09/08/2016 02:57 AM, Fenghua Yu wrote:
> +void rdtgroup_fork(struct task_struct *child)
> +{
> + struct rdtgroup *rdtgrp;
> +
> + INIT_LIST_HEAD(&child->rg_list);
> + if (!rdtgroup_mounted)
> + return;
> +
> + mutex_lock(&rdtgroup_mutex);
> +
> + rdtgrp = current->rdtgroup;
> + if (!rdtgrp)
> + goto out;
> +
> + list_add_tail(&child->rg_list, &rdtgrp->pset.tasks);
> + child->rdtgroup = rdtgrp;
> + atomic_inc(&rdtgrp->refcount);
> +
> +out:
> + mutex_unlock(&rdtgroup_mutex);
> +}
...
> diff --git a/kernel/fork.c b/kernel/fork.c
> index beb3172..79bfc99 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -76,6 +76,7 @@
> #include <linux/compiler.h>
> #include <linux/sysctl.h>
> #include <linux/kcov.h>
> +#include <linux/resctrl.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> @@ -1426,6 +1427,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
> p->io_context = NULL;
> p->audit_context = NULL;
> cgroup_fork(p);
> + rdtgroup_fork(p);
> #ifdef CONFIG_NUMA
> p->mempolicy = mpol_dup(p->mempolicy);
> if (IS_ERR(p->mempolicy)) {
Yikes, is this a new global lock and possible atomic_inc() on a shared
variable in the fork() path? Has there been any performance or
scalability testing done on this code?
That mutex could be a disaster for fork() once the filesystem is
mounted. Even if it goes away, if you have a large number of processes
in an rdtgroup and they are forking a lot, you're bound to see the
rdtgrp->refcount get bounced around a lot.
Powered by blists - more mailing lists