Selaa lähdekoodia

Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull core kernel fixes from Ingo Molnar:
 "Two small fixes"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Documentation: Reflect the new location of the NMI watchdog info
  nohz: Fix idle ticks in cpu summary line of /proc/stat
Linus Torvalds 12 vuotta sitten
vanhempi
commit
684baeb1d7
2 muutettua tiedostoa jossa 12 lisäystä ja 6 poistoa
  1. 2 2
      Documentation/00-INDEX
  2. 10 4
      fs/proc/stat.c

+ 2 - 2
Documentation/00-INDEX

@@ -210,6 +210,8 @@ local_ops.txt
 	- semantics and behavior of local atomic operations.
 	- semantics and behavior of local atomic operations.
 lockdep-design.txt
 lockdep-design.txt
 	- documentation on the runtime locking correctness validator.
 	- documentation on the runtime locking correctness validator.
+lockup-watchdogs.txt
+	- info on soft and hard lockup detectors (aka nmi_watchdog).
 logo.gif
 logo.gif
 	- full colour GIF image of Linux logo (penguin - Tux).
 	- full colour GIF image of Linux logo (penguin - Tux).
 logo.txt
 logo.txt
@@ -240,8 +242,6 @@ netlabel/
 	- directory with information on the NetLabel subsystem.
 	- directory with information on the NetLabel subsystem.
 networking/
 networking/
 	- directory with info on various aspects of networking with Linux.
 	- directory with info on various aspects of networking with Linux.
-nmi_watchdog.txt
-	- info on NMI watchdog for SMP systems.
 nommu-mmap.txt
 nommu-mmap.txt
 	- documentation about no-mmu memory mapping support.
 	- documentation about no-mmu memory mapping support.
 numastat.txt
 numastat.txt

+ 10 - 4
fs/proc/stat.c

@@ -45,10 +45,13 @@ static cputime64_t get_iowait_time(int cpu)
 
 
 static u64 get_idle_time(int cpu)
 static u64 get_idle_time(int cpu)
 {
 {
-	u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL);
+	u64 idle, idle_time = -1ULL;
+
+	if (cpu_online(cpu))
+		idle_time = get_cpu_idle_time_us(cpu, NULL);
 
 
 	if (idle_time == -1ULL)
 	if (idle_time == -1ULL)
-		/* !NO_HZ so we can rely on cpustat.idle */
+		/* !NO_HZ or cpu offline so we can rely on cpustat.idle */
 		idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
 		idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
 	else
 	else
 		idle = usecs_to_cputime64(idle_time);
 		idle = usecs_to_cputime64(idle_time);
@@ -58,10 +61,13 @@ static u64 get_idle_time(int cpu)
 
 
 static u64 get_iowait_time(int cpu)
 static u64 get_iowait_time(int cpu)
 {
 {
-	u64 iowait, iowait_time = get_cpu_iowait_time_us(cpu, NULL);
+	u64 iowait, iowait_time = -1ULL;
+
+	if (cpu_online(cpu))
+		iowait_time = get_cpu_iowait_time_us(cpu, NULL);
 
 
 	if (iowait_time == -1ULL)
 	if (iowait_time == -1ULL)
-		/* !NO_HZ so we can rely on cpustat.iowait */
+		/* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
 		iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
 		iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
 	else
 	else
 		iowait = usecs_to_cputime64(iowait_time);
 		iowait = usecs_to_cputime64(iowait_time);