aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-25 04:48:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:46 -0400
commit081e4c8a75692c21f3a119a81ca3270081879d0e (patch)
treeded825beb43c21c28e3ff4fdf0e4efe6a2b0ca66 /kernel
parent49b5cf34727a6c1be1568ab28e89a2d9a6bf51e0 (diff)
bsdacct: rename acct_gbls to bsd_acct_struct
After I fixed access to task->tgid in kernel/acct.c, Oleg pointed out some bad side effects with this accounting vs pid namespaces interaction. I.e. when some task in pid namespace sets this accounting up, this blocks all the others from doing the same. Restricting this to init namespace only could help, but didn't look a graceful solution. So here is the approach to make this accounting work with pid namespaces properly. The idea is simple - when a task dies it accounts itself in each namespace it is visible from and which set the accounting up. For example here are the commands run and the output of lastcomm from init and sub namespaces: init_ns# accton pacct sub_ns# accton pacct (this is a different file - sub ns is run in a chroot-ed environment) init_ns# cat /dev/null sub_ns# ls /dev/null init_ns# accton sub_ns# accton sub_ns# lastcomm -f pacct ls 0 [136,0] 0.00 secs Thu May 15 10:30 accton 0 [136,0] 0.00 secs Thu May 15 10:30 init_ns# lastcomm -f pacct accton root pts/0 0.00 secs Thu May 15 14:30 << got from sub cat root pts/1 0.00 secs Thu May 15 14:30 ls root pts/0 0.00 secs Thu May 15 14:30 << got from sub accton root pts/1 0.00 secs Thu May 15 14:30 That was the summary, the details are in patches. This patch: It will be visible in pid_namespace.h file, so fix its name to look better outside the acct.c file. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Balbir Singh <balbir@in.ibm.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/acct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 91e1cfd734d2..ee3e605190f9 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -82,7 +82,7 @@ static void do_acct_process(struct pid_namespace *ns, struct file *);
82 * can be placed in the same cache line as the lock. This primes 82 * can be placed in the same cache line as the lock. This primes
83 * the cache line to have the data after getting the lock. 83 * the cache line to have the data after getting the lock.
84 */ 84 */
85struct acct_glbs { 85struct bsd_acct_struct {
86 spinlock_t lock; 86 spinlock_t lock;
87 volatile int active; 87 volatile int active;
88 volatile int needcheck; 88 volatile int needcheck;
@@ -91,7 +91,7 @@ struct acct_glbs {
91 struct timer_list timer; 91 struct timer_list timer;
92}; 92};
93 93
94static struct acct_glbs acct_globals __cacheline_aligned = 94static struct bsd_acct_struct acct_globals __cacheline_aligned =
95 {__SPIN_LOCK_UNLOCKED(acct_globals.lock)}; 95 {__SPIN_LOCK_UNLOCKED(acct_globals.lock)};
96 96
97/* 97/*