Module: xenomai-forge
Branch: master
Commit: 674b8a4b9998518c5adb3030a94915bb63160fde
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=674b8a4b9998518c5adb3030a94915bb63160fde

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Aug 29 16:49:18 2013 +0200

cobalt/shadow: fix refcounting of system personality users

---

 kernel/cobalt/shadow.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/kernel/cobalt/shadow.c b/kernel/cobalt/shadow.c
index 8977bee..d711620 100644
--- a/kernel/cobalt/shadow.c
+++ b/kernel/cobalt/shadow.c
@@ -1127,18 +1127,11 @@ EXPORT_SYMBOL_GPL(xnshadow_map_kernel);
 
 void xnshadow_finalize(struct xnthread *thread)
 {
-       struct xnsys_ppd *sys_ppd;
-
        trace_mark(xn_nucleus, shadow_finalize,
                   "thread %p thread_name %s pid %d",
                   thread, xnthread_name(thread), xnthread_host_pid(thread));
 
        xnthread_run_handler(thread, finalize_thread);
-
-       if (xnthread_test_state(thread, XNUSER)) {
-               sys_ppd = xnsys_ppd_get(0);
-               atomic_dec(&sys_ppd->refcnt);
-       }
 }
 
 static int xnshadow_sys_migrate(int domain)
@@ -2243,7 +2236,7 @@ static int handle_taskexit_event(struct task_struct *p) 
/* p == current */
                xnheap_free(&sys_ppd->sem_heap, thread->u_window);
                thread->u_window = NULL;
                mm = xnshadow_current_mm();
-               if (atomic_read(&sys_ppd->refcnt) == 0)
+               if (atomic_dec_and_test(&sys_ppd->refcnt))
                        ppd_remove_mm(mm, detach_ppd);
        }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to