[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20060917151221.11160.57605.sendpatchset@localhost.localdomain>
Date: Sun, 17 Sep 2006 20:42:21 +0530
From: Balbir Singh <balbir@...ibm.com>
To: Kirill Korotaev <dev@...ru>
Cc: Rik van Riel <riel@...hat.com>, Srivatsa <vatsa@...ibm.com>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
CKRM-Tech <ckrm-tech@...ts.sourceforge.net>,
Dave Hansen <haveblue@...ibm.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...e.de>, Christoph Hellwig <hch@...radead.org>,
Andrey Savochkin <saw@...ru>,
Matt Helsley <matthltc@...ibm.com>,
Hugh Dickins <hugh@...itas.com>,
Alexey Dobriyan <adobriyan@...l.ru>,
Oleg Nesterov <oleg@...sign.ru>, devel@...nvz.org,
Pavel Emelianov <xemul@...nvz.org>,
Balbir Singh <balbir@...ibm.com>
Subject: [RFC][PATCH 1/4] Add a beancounter per tgid
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 <balbir@...ibm.com>
---
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists