Merge branch 'bkl-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Dec 2009 16:07:17 +0000 (08:07 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Dec 2009 16:07:17 +0000 (08:07 -0800)
* 'bkl-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  sys: Remove BKL from sys_reboot
  pm_qos: clean up racy global "name" variable
  pm_qos: remove BKL

1  2 
kernel/sys.c

diff --combined kernel/sys.c
@@@ -8,7 -8,6 +8,6 @@@
  #include <linux/mm.h>
  #include <linux/utsname.h>
  #include <linux/mman.h>
- #include <linux/smp_lock.h>
  #include <linux/notifier.h>
  #include <linux/reboot.h>
  #include <linux/prctl.h>
@@@ -349,6 -348,9 +348,9 @@@ void kernel_power_off(void
        machine_power_off();
  }
  EXPORT_SYMBOL_GPL(kernel_power_off);
+ static DEFINE_MUTEX(reboot_mutex);
  /*
   * Reboot system call: for obvious reasons only root may call it,
   * and even root needs to set up some magic numbers in the registers
@@@ -381,7 -383,7 +383,7 @@@ SYSCALL_DEFINE4(reboot, int, magic1, in
        if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
                cmd = LINUX_REBOOT_CMD_HALT;
  
-       lock_kernel();
+       mutex_lock(&reboot_mutex);
        switch (cmd) {
        case LINUX_REBOOT_CMD_RESTART:
                kernel_restart(NULL);
  
        case LINUX_REBOOT_CMD_HALT:
                kernel_halt();
-               unlock_kernel();
                do_exit(0);
                panic("cannot halt");
  
        case LINUX_REBOOT_CMD_POWER_OFF:
                kernel_power_off();
-               unlock_kernel();
                do_exit(0);
                break;
  
        case LINUX_REBOOT_CMD_RESTART2:
                if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) {
-                       unlock_kernel();
-                       return -EFAULT;
+                       ret = -EFAULT;
+                       break;
                }
                buffer[sizeof(buffer) - 1] = '\0';
  
                ret = -EINVAL;
                break;
        }
-       unlock_kernel();
+       mutex_unlock(&reboot_mutex);
        return ret;
  }
  
@@@ -911,15 -911,16 +911,15 @@@ change_okay
  
  void do_sys_times(struct tms *tms)
  {
 -      struct task_cputime cputime;
 -      cputime_t cutime, cstime;
 +      cputime_t tgutime, tgstime, cutime, cstime;
  
 -      thread_group_cputime(current, &cputime);
        spin_lock_irq(&current->sighand->siglock);
 +      thread_group_times(current, &tgutime, &tgstime);
        cutime = current->signal->cutime;
        cstime = current->signal->cstime;
        spin_unlock_irq(&current->sighand->siglock);
 -      tms->tms_utime = cputime_to_clock_t(cputime.utime);
 -      tms->tms_stime = cputime_to_clock_t(cputime.stime);
 +      tms->tms_utime = cputime_to_clock_t(tgutime);
 +      tms->tms_stime = cputime_to_clock_t(tgstime);
        tms->tms_cutime = cputime_to_clock_t(cutime);
        tms->tms_cstime = cputime_to_clock_t(cstime);
  }
@@@ -1109,8 -1110,6 +1109,8 @@@ SYSCALL_DEFINE0(setsid
        err = session;
  out:
        write_unlock_irq(&tasklist_lock);
 +      if (err > 0)
 +              proc_sid_connector(group_leader);
        return err;
  }
  
@@@ -1337,14 -1336,16 +1337,14 @@@ static void k_getrusage(struct task_str
  {
        struct task_struct *t;
        unsigned long flags;
 -      cputime_t utime, stime;
 -      struct task_cputime cputime;
 +      cputime_t tgutime, tgstime, utime, stime;
        unsigned long maxrss = 0;
  
        memset((char *) r, 0, sizeof *r);
        utime = stime = cputime_zero;
  
        if (who == RUSAGE_THREAD) {
 -              utime = task_utime(current);
 -              stime = task_stime(current);
 +              task_times(current, &utime, &stime);
                accumulate_thread_rusage(p, r);
                maxrss = p->signal->maxrss;
                goto out;
                                break;
  
                case RUSAGE_SELF:
 -                      thread_group_cputime(p, &cputime);
 -                      utime = cputime_add(utime, cputime.utime);
 -                      stime = cputime_add(stime, cputime.stime);
 +                      thread_group_times(p, &tgutime, &tgstime);
 +                      utime = cputime_add(utime, tgutime);
 +                      stime = cputime_add(stime, tgstime);
                        r->ru_nvcsw += p->signal->nvcsw;
                        r->ru_nivcsw += p->signal->nivcsw;
                        r->ru_minflt += p->signal->min_flt;
@@@ -1545,37 -1546,24 +1545,37 @@@ SYSCALL_DEFINE5(prctl, int, option, uns
                        if (arg4 | arg5)
                                return -EINVAL;
                        switch (arg2) {
 -                      case 0:
 +                      case PR_MCE_KILL_CLEAR:
                                if (arg3 != 0)
                                        return -EINVAL;
                                current->flags &= ~PF_MCE_PROCESS;
                                break;
 -                      case 1:
 +                      case PR_MCE_KILL_SET:
                                current->flags |= PF_MCE_PROCESS;
 -                              if (arg3 != 0)
 +                              if (arg3 == PR_MCE_KILL_EARLY)
                                        current->flags |= PF_MCE_EARLY;
 -                              else
 +                              else if (arg3 == PR_MCE_KILL_LATE)
                                        current->flags &= ~PF_MCE_EARLY;
 +                              else if (arg3 == PR_MCE_KILL_DEFAULT)
 +                                      current->flags &=
 +                                              ~(PF_MCE_EARLY|PF_MCE_PROCESS);
 +                              else
 +                                      return -EINVAL;
                                break;
                        default:
                                return -EINVAL;
                        }
                        error = 0;
                        break;
 -
 +              case PR_MCE_KILL_GET:
 +                      if (arg2 | arg3 | arg4 | arg5)
 +                              return -EINVAL;
 +                      if (current->flags & PF_MCE_PROCESS)
 +                              error = (current->flags & PF_MCE_EARLY) ?
 +                                      PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE;
 +                      else
 +                              error = PR_MCE_KILL_DEFAULT;
 +                      break;
                default:
                        error = -EINVAL;
                        break;