提交 e25ff11f 编写于 作者: A Al Viro

split the slow path in acct_process() off

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 cdd37e23
...@@ -599,34 +599,35 @@ void acct_collect(long exitcode, int group_dead) ...@@ -599,34 +599,35 @@ void acct_collect(long exitcode, int group_dead)
spin_unlock_irq(&current->sighand->siglock); spin_unlock_irq(&current->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) ...@@ -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);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册