mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@in.ibm.com>
To: Kirill Korotaev <dev@sw.ru>
Cc: Rik van Riel <riel@redhat.com>, Srivatsa <vatsa@in.ibm.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	CKRM-Tech <ckrm-tech@lists.sourceforge.net>,
	Dave Hansen <haveblue@us.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@suse.de>, Christoph Hellwig <hch@infradead.org>,
	Andrey Savochkin <saw@sw.ru>, Matt Helsley <matthltc@us.ibm.com>,
	Hugh Dickins <hugh@veritas.com>,
	Alexey Dobriyan <adobriyan@mail.ru>,
	Oleg Nesterov <oleg@tv-sign.ru>,
	devel@openvz.org, Pavel Emelianov <xemul@openvz.org>,
	Balbir Singh <balbir@in.ibm.com>
Subject: [RFC][PATCH 1/4] Add a beancounter per tgid
Date: Sun, 17 Sep 2006 20:42:21 +0530	[thread overview]
Message-ID: <20060917151221.11160.57605.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060917151212.11160.2513.sendpatchset@localhost.localdomain>



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@in.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

  reply	other threads:[~2006-09-17 17:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-17 15:12 [RFC][PATCH 0/4] Aggregated beancounters (v3) Balbir Singh
2006-09-17 15:12 ` Balbir Singh [this message]
2006-09-17 15:12 ` [RFC][PATCH 2/4] Aggregated beancounters infrastructure Balbir Singh
2006-09-17 15:12 ` [RFC][PATCH 3/4] Aggregated beancounters syscall support Balbir Singh
2006-09-17 15:12 ` [RFC][PATCH 4/4] " Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060917151221.11160.57605.sendpatchset@localhost.localdomain \
    --to=balbir@in.ibm.com \
    --cc=adobriyan@mail.ru \
    --cc=ak@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ckrm-tech@lists.sourceforge.net \
    --cc=dev@sw.ru \
    --cc=devel@openvz.org \
    --cc=haveblue@us.ibm.com \
    --cc=hch@infradead.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthltc@us.ibm.com \
    --cc=oleg@tv-sign.ru \
    --cc=riel@redhat.com \
    --cc=saw@sw.ru \
    --cc=vatsa@in.ibm.com \
    --cc=xemul@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome