Skip to contentSkip to conversation

Bsdacct: stir up comments around acct_process.

PATCH In review Pavel Emelyanov 2 participants 2 messages May 16, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bsdacct: stir up comments around acct_process.

Fix the one describing what this function is and add one more - about locking absence around pid namespaces loop.

---

kernel/acct.c +7 -1
index 0feba97..d7b670c 100644
@@ -657,7 +657,8 @@ static void acct_process_in_ns(struct pid_namespace *ns)
 }
 
 /**
- * acct_process - now just a wrapper around do_acct_process
+ * acct_process - now just a wrapper around acct_process_in_ns,
+ * which int turn is a wrapper around do_acct_process.
  *
  * handles process accounting for an exiting task
  */
@@ -665,6 +666,11 @@ void acct_process(void)
 {
 	struct pid_namespace *ns;
 
+	/*
+	 * This loop is safe lockless, since current it still
+	 * alive and holds its namespace, which in turn holds
+	 * its parent.
+	 */
 	for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent)
 		acct_process_in_ns(ns);
 }
#1 lore raw
Quoted 12 lines · On Fri, 16 May 2008 14:54:59 +0400 Pavel Emelyanov wrote:

Fix the one describing what this function is and add one more - about locking absence around pid namespaces loop.

---

kernel/acct.c +0 -0
index 0feba97..d7b670c 100644

kernel/acct.c static void acct_process_in_ns(struct pid_namespace *ns) · line 661

Quoted 6 lines
kernel/acct.c +2 -1
@@ -657,7 +657,8 @@ static void acct_process_in_ns(struct pid_namespace *ns)
 }
 
 /**
- * acct_process - now just a wrapper around do_acct_process
+ * acct_process - now just a wrapper around acct_process_in_ns,
+ * which int turn is a wrapper around do_acct_process.

in

kernel/acct.c void acct_process(void) · line 670

Quoted 9 lines
kernel/acct.c +2 -0
  *
  * handles process accounting for an exiting task
  */
@@ -665,6 +666,11 @@ void acct_process(void)
 {
 	struct pid_namespace *ns;
 
+	/*
+	 * This loop is safe lockless, since current it still

is still

kernel/acct.c void acct_process(void) · line 676

Quoted 6 lines
kernel/acct.c +3 -0
+	 * alive and holds its namespace, which in turn holds
+	 * its parent.
+	 */
 	for (ns = task_active_pid_ns(current); ns != NULL; ns = ns->parent)
 		acct_process_in_ns(ns);
 }

---
~Randy