split the slow path in acct_process() off
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
cdd37e2309
commit
e25ff11ff1
1 changed files with 28 additions and 22 deletions
|
@ -599,34 +599,35 @@ void acct_collect(long exitcode, int group_dead)
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acct_process_in_ns(struct pid_namespace *ns)
|
static void slow_acct_process(struct pid_namespace *ns)
|
||||||
{
|
{
|
||||||
struct file *file = NULL;
|
for ( ; ns; ns = ns->parent) {
|
||||||
struct bsd_acct_struct *acct;
|
struct file *file = NULL;
|
||||||
|
struct bsd_acct_struct *acct;
|
||||||
|
|
||||||
acct = ns->bacct;
|
acct = ns->bacct;
|
||||||
/*
|
/*
|
||||||
* accelerate the common fastpath:
|
* accelerate the common fastpath:
|
||||||
*/
|
*/
|
||||||
if (!acct || !acct->file)
|
if (!acct || !acct->file)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
spin_lock(&acct_lock);
|
spin_lock(&acct_lock);
|
||||||
file = acct->file;
|
file = acct->file;
|
||||||
if (unlikely(!file)) {
|
if (unlikely(!file)) {
|
||||||
|
spin_unlock(&acct_lock);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
get_file(file);
|
||||||
spin_unlock(&acct_lock);
|
spin_unlock(&acct_lock);
|
||||||
return;
|
|
||||||
}
|
|
||||||
get_file(file);
|
|
||||||
spin_unlock(&acct_lock);
|
|
||||||
|
|
||||||
do_acct_process(acct, ns, file);
|
do_acct_process(acct, ns, file);
|
||||||
fput(file);
|
fput(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* acct_process - now just a wrapper around acct_process_in_ns,
|
* acct_process
|
||||||
* which in turn is a wrapper around do_acct_process.
|
|
||||||
*
|
*
|
||||||
* handles process accounting for an exiting task
|
* handles process accounting for an exiting task
|
||||||
*/
|
*/
|
||||||
|
@ -639,6 +640,11 @@ void acct_process(void)
|
||||||
* alive and holds its namespace, which in turn holds
|
* alive and holds its namespace, which in turn holds
|
||||||
* its parent.
|
* its parent.
|
||||||
*/
|
*/
|
||||||
for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent)
|
for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent) {
|
||||||
acct_process_in_ns(ns);
|
struct bsd_acct_struct *acct = ns->bacct;
|
||||||
|
if (acct && acct->file)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (unlikely(ns))
|
||||||
|
slow_acct_process(ns);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue