Create one beancounter per thread group. This is the base patch and serves
as the starting point for aggregating thread groups.
Signed-off-by: Balbir Singh <[email protected]>
---
kernel/bc/misc.c | 11 +++++++----
kernel/fork.c | 4 ++--
2 files changed, 9 insertions(+), 6 deletions(-)
diff -puN kernel/bc/misc.c~per-tgid-beancounters kernel/bc/misc.c
--- linux-2.6.18-rc5/kernel/bc/misc.c~per-tgid-beancounters 2006-09-12 22:27:02.000000000 +0530
+++ linux-2.6.18-rc5-balbir/kernel/bc/misc.c 2006-09-17 20:30:55.000000000 +0530
@@ -12,15 +12,18 @@
void bc_task_charge(struct task_struct *parent, struct task_struct *new)
{
- struct task_beancounter *old_bc;
struct task_beancounter *new_bc;
struct beancounter *bc;
- old_bc = &parent->task_bc;
new_bc = &new->task_bc;
+ bc = beancounter_findcreate(new->tgid, BC_ALLOC);
+ if (!bc) {
+ printk(KERN_WARNING "failed to create bc %d for tgid %d\n",
+ bc->bc_id, new->tgid);
+ return;
+ }
- bc = old_bc->fork_bc;
- new_bc->exec_bc = get_beancounter(bc);
+ new_bc->exec_bc = bc;
new_bc->fork_bc = get_beancounter(bc);
}
diff -puN kernel/fork.c~per-tgid-beancounters kernel/fork.c
--- linux-2.6.18-rc5/kernel/fork.c~per-tgid-beancounters 2006-09-12 22:27:02.000000000 +0530
+++ linux-2.6.18-rc5-balbir/kernel/fork.c 2006-09-12 22:32:26.000000000 +0530
@@ -994,8 +994,6 @@ static struct task_struct *copy_process(
if (!p)
goto fork_out;
- bc_task_charge(current, p);
-
#ifdef CONFIG_TRACE_IRQFLAGS
DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
@@ -1106,6 +1104,8 @@ static struct task_struct *copy_process(
if (clone_flags & CLONE_THREAD)
p->tgid = current->tgid;
+ bc_task_charge(current, p);
+
if ((retval = security_task_alloc(p)))
goto bad_fork_cleanup_policy;
if ((retval = audit_alloc(p)))
_
--
Balbir Singh,
Linux Technology Center,
IBM Software Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]