umd: Track user space drivers with struct pid
[linux-2.6-microblaze.git] / kernel / exit.c
index c300253..d3294b6 100644 (file)
 #include <linux/random.h>
 #include <linux/rcuwait.h>
 #include <linux/compat.h>
+#include <linux/usermode_driver.h>
 
 #include <linux/uaccess.h>
 #include <asm/unistd.h>
-#include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 
 static void __unhash_process(struct task_struct *p, bool group_dead)
@@ -441,17 +441,17 @@ static void exit_mm(void)
        sync_mm_rss(mm);
        /*
         * Serialize with any possible pending coredump.
-        * We must hold mmap_sem around checking core_state
+        * We must hold mmap_lock around checking core_state
         * and clearing tsk->mm.  The core-inducing thread
         * will increment ->nr_threads for each thread in the
         * group with ->mm != NULL.
         */
-       down_read(&mm->mmap_sem);
+       mmap_read_lock(mm);
        core_state = mm->core_state;
        if (core_state) {
                struct core_thread self;
 
-               up_read(&mm->mmap_sem);
+               mmap_read_unlock(mm);
 
                self.task = current;
                self.next = xchg(&core_state->dumper.next, &self);
@@ -469,14 +469,14 @@ static void exit_mm(void)
                        freezable_schedule();
                }
                __set_current_state(TASK_RUNNING);
-               down_read(&mm->mmap_sem);
+               mmap_read_lock(mm);
        }
        mmgrab(mm);
        BUG_ON(mm != current->active_mm);
        /* more a memory barrier than a real lock */
        task_lock(current);
        current->mm = NULL;
-       up_read(&mm->mmap_sem);
+       mmap_read_unlock(mm);
        enter_lazy_tlb(mm, current);
        task_unlock(current);
        mm_update_next_owner(mm);
@@ -805,7 +805,8 @@ void __noreturn do_exit(long code)
        exit_task_namespaces(tsk);
        exit_task_work(tsk);
        exit_thread(tsk);
-       exit_umh(tsk);
+       if (group_dead)
+               exit_umh(tsk);
 
        /*
         * Flush inherited counters to the parent - before the parent