exit.c (8aa0a410af8011d557877e558f9ff17c082c6840) exit.c (37f08be11be9a7d9351fb1b9b408259519a126f3)
1/*
2 * linux/kernel/exit.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7#include <linux/mm.h>
8#include <linux/slab.h>

--- 410 unchanged lines hidden (view full) ---

419
420 /*
421 * If we were started as result of loading a module, close all of the
422 * user space pages. We don't need them, and if we didn't close them
423 * they would be locked into memory.
424 */
425 exit_mm(current);
426 /*
1/*
2 * linux/kernel/exit.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7#include <linux/mm.h>
8#include <linux/slab.h>

--- 410 unchanged lines hidden (view full) ---

419
420 /*
421 * If we were started as result of loading a module, close all of the
422 * user space pages. We don't need them, and if we didn't close them
423 * they would be locked into memory.
424 */
425 exit_mm(current);
426 /*
427 * We don't want to have TIF_FREEZE set if the system-wide hibernation
427 * We don't want to get frozen, in case system-wide hibernation
428 * or suspend transition begins right now.
429 */
430 current->flags |= (PF_NOFREEZE | PF_KTHREAD);
431
432 if (current->nsproxy != &init_nsproxy) {
433 get_nsproxy(&init_nsproxy);
434 switch_task_namespaces(current, &init_nsproxy);
435 }

--- 597 unchanged lines hidden (view full) ---

1033 __free_pipe_info(tsk->splice_pipe);
1034
1035 validate_creds_for_do_exit(tsk);
1036
1037 preempt_disable();
1038 if (tsk->nr_dirtied)
1039 __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied);
1040 exit_rcu();
428 * or suspend transition begins right now.
429 */
430 current->flags |= (PF_NOFREEZE | PF_KTHREAD);
431
432 if (current->nsproxy != &init_nsproxy) {
433 get_nsproxy(&init_nsproxy);
434 switch_task_namespaces(current, &init_nsproxy);
435 }

--- 597 unchanged lines hidden (view full) ---

1033 __free_pipe_info(tsk->splice_pipe);
1034
1035 validate_creds_for_do_exit(tsk);
1036
1037 preempt_disable();
1038 if (tsk->nr_dirtied)
1039 __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied);
1040 exit_rcu();
1041
1042 /*
1043 * The setting of TASK_RUNNING by try_to_wake_up() may be delayed
1044 * when the following two conditions become true.
1045 * - There is race condition of mmap_sem (It is acquired by
1046 * exit_mm()), and
1047 * - SMI occurs before setting TASK_RUNINNG.
1048 * (or hypervisor of virtual machine switches to other guest)
1049 * As a result, we may become TASK_RUNNING after becoming TASK_DEAD
1050 *
1051 * To avoid it, we have to wait for releasing tsk->pi_lock which
1052 * is held by try_to_wake_up()
1053 */
1054 smp_mb();
1055 raw_spin_unlock_wait(&tsk->pi_lock);
1056
1057 /* causes final put_task_struct in finish_task_switch(). */
1058 tsk->state = TASK_DEAD;
1059 tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */
1060 schedule();
1061 BUG();
1062 /* Avoid "noreturn function does return". */
1063 for (;;)
1064 cpu_relax(); /* For when BUG is null */

--- 804 unchanged lines hidden ---
1041 /* causes final put_task_struct in finish_task_switch(). */
1042 tsk->state = TASK_DEAD;
1043 tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */
1044 schedule();
1045 BUG();
1046 /* Avoid "noreturn function does return". */
1047 for (;;)
1048 cpu_relax(); /* For when BUG is null */

--- 804 unchanged lines hidden ---