- sys_getppid-oopses-on-debug-kernel-v2-simplify.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     sys_getppid-oopses-on-debug-kernel-v2-simplify

has been removed from the -mm tree.  Its filename is

     sys_getppid-oopses-on-debug-kernel-v2-simplify.patch

This patch was dropped because it was folded into sys_getppid-oopses-on-debug-kernel-v2.patch

------------------------------------------------------
Subject: sys_getppid-oopses-on-debug-kernel-v2-simplify
From: Oleg Nesterov <oleg@xxxxxxxxxx>

On top of Kirill's sys_getppid-oopses-on-debug-kernel-v2.patch

- We don't need ->group_leader->real_parent, all threads should
  have the same ->real_parent.

- We don't need tasklist_lock, task_struct is freed by RCU, so
  rcu_read_lock() should be enough.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
Cc: Kirill Korotaev <dev@xxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 kernel/timer.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff -puN kernel/timer.c~sys_getppid-oopses-on-debug-kernel-v2-simplify kernel/timer.c
--- a/kernel/timer.c~sys_getppid-oopses-on-debug-kernel-v2-simplify
+++ a/kernel/timer.c
@@ -1324,28 +1324,18 @@ asmlinkage long sys_getpid(void)
 }
 
 /*
- * Accessing ->group_leader->real_parent is not SMP-safe, it could
- * change from under us. However, rather than getting any lock
- * we can use an optimistic algorithm: get the parent
- * pid, and go back and check that the parent is still
- * the same. If it has changed (which is extremely unlikely
- * indeed), we just try again..
- *
- * NOTE! This depends on the fact that even if we _do_
- * get an old value of "parent", we can happily dereference
- * the pointer (it was and remains a dereferencable kernel pointer
- * no matter what): we just can't necessarily trust the result
- * until we know that the parent pointer is valid.
- *
- * NOTE2: ->group_leader never changes from under us.
+ * Accessing ->real_parent is not SMP-safe, it could
+ * change from under us. However, we can use a stale
+ * value of ->real_parent under rcu_read_lock(), see
+ * release_task()->call_rcu(delayed_put_task_struct).
  */
 asmlinkage long sys_getppid(void)
 {
 	int pid;
 
-	read_lock(&tasklist_lock);
-	pid = current->group_leader->real_parent->tgid;
-	read_unlock(&tasklist_lock);
+	rcu_read_lock();
+	pid = rcu_dereference(current->real_parent)->tgid;
+	rcu_read_unlock();
 
 	return pid;
 }
_

Patches currently in -mm which might be from oleg@xxxxxxxxxx are

sys_getppid-oopses-on-debug-kernel-v2.patch
sys_getppid-oopses-on-debug-kernel-v2-simplify.patch
pid-implement-transfer_pid-and-use-it-to-simplify-de_thread.patch
pid-remove-temporary-debug-code-in-attach_pid.patch
rtmutex-clean-up-and-remove-some-extra-spinlocks.patch
pidhash-temporary-debug-checks.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux