aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/setup.c2
-rw-r--r--arch/i386/mach-visws/visws_apic.c7
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds8
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds8
-rw-r--r--arch/s390/appldata/appldata_base.c1
-rw-r--r--arch/s390/kernel/compat_linux.c4
-rw-r--r--arch/s390/kernel/compat_signal.c12
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/signal.c12
-rw-r--r--arch/s390/kernel/traps.c20
-rw-r--r--drivers/base/Kconfig4
-rw-r--r--drivers/block/cciss.c8
-rw-r--r--drivers/char/watchdog/sc1200wdt.c9
-rw-r--r--drivers/ide/pci/generic.c6
-rw-r--r--drivers/ieee1394/ohci1394.c19
-rw-r--r--drivers/md/md.c8
-rw-r--r--drivers/md/multipath.c2
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c4
-rw-r--r--drivers/misc/ioc4.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c7
-rw-r--r--drivers/pcmcia/at91_cf.c28
-rw-r--r--drivers/pcmcia/au1000_generic.c25
-rw-r--r--drivers/pcmcia/ds.c29
-rw-r--r--drivers/pcmcia/i82092.c9
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c12
-rw-r--r--drivers/pcmcia/omap_cf.c3
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c11
-rw-r--r--drivers/pcmcia/pcmcia_resource.c2
-rw-r--r--drivers/pcmcia/pd6729.c4
-rw-r--r--drivers/pcmcia/soc_common.c1
-rw-r--r--drivers/pcmcia/yenta_socket.c22
-rw-r--r--drivers/s390/cio/css.c7
-rw-r--r--drivers/s390/cio/device.c3
-rw-r--r--drivers/s390/cio/device.h1
-rw-r--r--drivers/s390/crypto/ap_bus.c7
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/dcache.c19
-rw-r--r--fs/ext4/resize.c23
-rw-r--r--fs/hugetlbfs/inode.c25
-rw-r--r--fs/jbd/transaction.c15
-rw-r--r--fs/jbd2/transaction.c15
-rw-r--r--fs/splice.c9
-rw-r--r--include/asm-i386/mach-visws/do_timer.h53
-rw-r--r--include/asm-i386/mach-visws/mach_apic.h5
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/mmzone.h6
-rw-r--r--include/linux/pagemap.h14
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/taskstats_kern.h31
-rw-r--r--include/linux/vmalloc.h3
-rw-r--r--kernel/compat.c2
-rw-r--r--kernel/cpu.c12
-rw-r--r--kernel/exit.c1
-rw-r--r--kernel/fork.c3
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/taskstats.c70
-rw-r--r--kernel/time/ntp.c2
-rw-r--r--kernel/tsacct.c7
-rw-r--r--kernel/workqueue.c6
-rw-r--r--lib/string.c2
-rw-r--r--mm/filemap.c24
-rw-r--r--mm/hugetlb.c3
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/sparse.c2
-rw-r--r--mm/vmalloc.c18
-rw-r--r--mm/vmscan.c63
-rw-r--r--mm/vmstat.c2
68 files changed, 411 insertions, 350 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 519e63c3c130..141041dde74d 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -846,7 +846,7 @@ efi_find_max_pfn(unsigned long start, unsigned long end, void *arg)
846static int __init 846static int __init
847efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg) 847efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg)
848{ 848{
849 memory_present(0, start, end); 849 memory_present(0, PFN_UP(start), PFN_DOWN(end));
850 return 0; 850 return 0;
851} 851}
852 852
diff --git a/arch/i386/mach-visws/visws_apic.c b/arch/i386/mach-visws/visws_apic.c
index 07097ed48890..38c2b13124d9 100644
--- a/arch/i386/mach-visws/visws_apic.c
+++ b/arch/i386/mach-visws/visws_apic.c
@@ -122,7 +122,7 @@ static void end_cobalt_irq(unsigned int irq)
122 spin_unlock_irqrestore(&cobalt_lock, flags); 122 spin_unlock_irqrestore(&cobalt_lock, flags);
123} 123}
124 124
125static struct hw_interrupt_type cobalt_irq_type = { 125static struct irq_chip cobalt_irq_type = {
126 .typename = "Cobalt-APIC", 126 .typename = "Cobalt-APIC",
127 .startup = startup_cobalt_irq, 127 .startup = startup_cobalt_irq,
128 .shutdown = disable_cobalt_irq, 128 .shutdown = disable_cobalt_irq,
@@ -159,7 +159,7 @@ static void end_piix4_master_irq(unsigned int irq)
159 spin_unlock_irqrestore(&cobalt_lock, flags); 159 spin_unlock_irqrestore(&cobalt_lock, flags);
160} 160}
161 161
162static struct hw_interrupt_type piix4_master_irq_type = { 162static struct irq_chip piix4_master_irq_type = {
163 .typename = "PIIX4-master", 163 .typename = "PIIX4-master",
164 .startup = startup_piix4_master_irq, 164 .startup = startup_piix4_master_irq,
165 .ack = ack_cobalt_irq, 165 .ack = ack_cobalt_irq,
@@ -167,9 +167,8 @@ static struct hw_interrupt_type piix4_master_irq_type = {
167}; 167};
168 168
169 169
170static struct hw_interrupt_type piix4_virtual_irq_type = { 170static struct irq_chip piix4_virtual_irq_type = {
171 .typename = "PIIX4-virtual", 171 .typename = "PIIX4-virtual",
172 .startup = startup_8259A_irq,
173 .shutdown = disable_8259A_irq, 172 .shutdown = disable_8259A_irq,
174 .enable = enable_8259A_irq, 173 .enable = enable_8259A_irq,
175 .disable = disable_8259A_irq, 174 .disable = disable_8259A_irq,
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 69d1d3d30c78..d2794452b195 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -54,13 +54,7 @@ SECTIONS
54 __setup_end = .; 54 __setup_end = .;
55 __initcall_start = .; 55 __initcall_start = .;
56 .initcall.init : { 56 .initcall.init : {
57 *(.initcall1.init) 57 INITCALLS
58 *(.initcall2.init)
59 *(.initcall3.init)
60 *(.initcall4.init)
61 *(.initcall5.init)
62 *(.initcall6.init)
63 *(.initcall7.init)
64 } 58 }
65 __initcall_end = .; 59 __initcall_end = .;
66 __con_initcall_start = .; 60 __con_initcall_start = .;
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 65cc39c24185..2550b4ae2732 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -48,13 +48,7 @@ __init_begin = .;
48 __setup_end = .; 48 __setup_end = .;
49 __initcall_start = .; 49 __initcall_start = .;
50 .initcall.init : { 50 .initcall.init : {
51 *(.initcall1.init) 51 INITCALLS
52 *(.initcall2.init)
53 *(.initcall3.init)
54 *(.initcall4.init)
55 *(.initcall5.init)
56 *(.initcall6.init)
57 *(.initcall7.init)
58 } 52 }
59 __initcall_end = .; 53 __initcall_end = .;
60 __con_initcall_start = .; 54 __con_initcall_start = .;
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 45c9fa7d7545..af1e8fc7d985 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -310,6 +310,7 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
310 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) { 310 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) {
311 return -EFAULT; 311 return -EFAULT;
312 } 312 }
313 interval = 0;
313 sscanf(buf, "%i", &interval); 314 sscanf(buf, "%i", &interval);
314 if (interval <= 0) { 315 if (interval <= 0) {
315 P_ERROR("Timer CPU interval has to be > 0!\n"); 316 P_ERROR("Timer CPU interval has to be > 0!\n");
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 2001767e1dc7..5b33f823863a 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -757,7 +757,9 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
757 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp))) 757 put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)))
758 error = -EFAULT; 758 error = -EFAULT;
759 } 759 }
760 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); 760 if (copy_to_user(args->__unused, tmp.__unused,
761 sizeof(tmp.__unused)))
762 error = -EFAULT;
761 } 763 }
762 return error; 764 return error;
763} 765}
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index d49b876a83bf..861888ab8c13 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -169,12 +169,12 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
169 compat_old_sigset_t mask; 169 compat_old_sigset_t mask;
170 if (!access_ok(VERIFY_READ, act, sizeof(*act)) || 170 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
171 __get_user(sa_handler, &act->sa_handler) || 171 __get_user(sa_handler, &act->sa_handler) ||
172 __get_user(sa_restorer, &act->sa_restorer)) 172 __get_user(sa_restorer, &act->sa_restorer) ||
173 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
174 __get_user(mask, &act->sa_mask))
173 return -EFAULT; 175 return -EFAULT;
174 new_ka.sa.sa_handler = (__sighandler_t) sa_handler; 176 new_ka.sa.sa_handler = (__sighandler_t) sa_handler;
175 new_ka.sa.sa_restorer = (void (*)(void)) sa_restorer; 177 new_ka.sa.sa_restorer = (void (*)(void)) sa_restorer;
176 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
177 __get_user(mask, &act->sa_mask);
178 siginitset(&new_ka.sa.sa_mask, mask); 178 siginitset(&new_ka.sa.sa_mask, mask);
179 } 179 }
180 180
@@ -185,10 +185,10 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
185 sa_restorer = (unsigned long) old_ka.sa.sa_restorer; 185 sa_restorer = (unsigned long) old_ka.sa.sa_restorer;
186 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || 186 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
187 __put_user(sa_handler, &oact->sa_handler) || 187 __put_user(sa_handler, &oact->sa_handler) ||
188 __put_user(sa_restorer, &oact->sa_restorer)) 188 __put_user(sa_restorer, &oact->sa_restorer) ||
189 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
190 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
189 return -EFAULT; 191 return -EFAULT;
190 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
191 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
192 } 192 }
193 193
194 return ret; 194 return ret;
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index cb0efae6802f..71e54ef0931e 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1664,4 +1664,4 @@ sys_getcpu_wrapper:
1664 llgtr %r2,%r2 # unsigned * 1664 llgtr %r2,%r2 # unsigned *
1665 llgtr %r3,%r3 # unsigned * 1665 llgtr %r3,%r3 # unsigned *
1666 llgtr %r4,%r4 # struct getcpu_cache * 1666 llgtr %r4,%r4 # struct getcpu_cache *
1667 jg sys_tee 1667 jg sys_getcpu
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 4392a77cbae8..4c8a7954ef48 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -80,10 +80,10 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
80 old_sigset_t mask; 80 old_sigset_t mask;
81 if (!access_ok(VERIFY_READ, act, sizeof(*act)) || 81 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
82 __get_user(new_ka.sa.sa_handler, &act->sa_handler) || 82 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
83 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) 83 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
84 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
85 __get_user(mask, &act->sa_mask))
84 return -EFAULT; 86 return -EFAULT;
85 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
86 __get_user(mask, &act->sa_mask);
87 siginitset(&new_ka.sa.sa_mask, mask); 87 siginitset(&new_ka.sa.sa_mask, mask);
88 } 88 }
89 89
@@ -92,10 +92,10 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
92 if (!ret && oact) { 92 if (!ret && oact) {
93 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || 93 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
94 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || 94 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
95 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) 95 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
96 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
97 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
96 return -EFAULT; 98 return -EFAULT;
97 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
98 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
99 } 99 }
100 100
101 return ret; 101 return ret;
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 66375a5e3d12..92ecffbc8d82 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -462,7 +462,8 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
462 local_irq_enable(); 462 local_irq_enable();
463 463
464 if (regs->psw.mask & PSW_MASK_PSTATE) { 464 if (regs->psw.mask & PSW_MASK_PSTATE) {
465 get_user(*((__u16 *) opcode), (__u16 __user *) location); 465 if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
466 return;
466 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) { 467 if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
467 if (current->ptrace & PT_PTRACED) 468 if (current->ptrace & PT_PTRACED)
468 force_sig(SIGTRAP, current); 469 force_sig(SIGTRAP, current);
@@ -470,20 +471,25 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
470 signal = SIGILL; 471 signal = SIGILL;
471#ifdef CONFIG_MATHEMU 472#ifdef CONFIG_MATHEMU
472 } else if (opcode[0] == 0xb3) { 473 } else if (opcode[0] == 0xb3) {
473 get_user(*((__u16 *) (opcode+2)), location+1); 474 if (get_user(*((__u16 *) (opcode+2)), location+1))
475 return;
474 signal = math_emu_b3(opcode, regs); 476 signal = math_emu_b3(opcode, regs);
475 } else if (opcode[0] == 0xed) { 477 } else if (opcode[0] == 0xed) {
476 get_user(*((__u32 *) (opcode+2)), 478 if (get_user(*((__u32 *) (opcode+2)),
477 (__u32 __user *)(location+1)); 479 (__u32 __user *)(location+1)))
480 return;
478 signal = math_emu_ed(opcode, regs); 481 signal = math_emu_ed(opcode, regs);
479 } else if (*((__u16 *) opcode) == 0xb299) { 482 } else if (*((__u16 *) opcode) == 0xb299) {
480 get_user(*((__u16 *) (opcode+2)), location+1); 483 if (get_user(*((__u16 *) (opcode+2)), location+1))
484 return;
481 signal = math_emu_srnm(opcode, regs); 485 signal = math_emu_srnm(opcode, regs);
482 } else if (*((__u16 *) opcode) == 0xb29c) { 486 } else if (*((__u16 *) opcode) == 0xb29c) {
483 get_user(*((__u16 *) (opcode+2)), location+1); 487 if (get_user(*((__u16 *) (opcode+2)), location+1))
488 return;
484 signal = math_emu_stfpc(opcode, regs); 489 signal = math_emu_stfpc(opcode, regs);
485 } else if (*((__u16 *) opcode) == 0xb29d) { 490 } else if (*((__u16 *) opcode) == 0xb29d) {
486 get_user(*((__u16 *) (opcode+2)), location+1); 491 if (get_user(*((__u16 *) (opcode+2)), location+1))
492 return;
487 signal = math_emu_lfpc(opcode, regs); 493 signal = math_emu_lfpc(opcode, regs);
488#endif 494#endif
489 } else 495 } else
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 0b4e22436935..1429f3a2629e 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -37,8 +37,8 @@ config DEBUG_DRIVER
37 37
38 If you are unsure about this, say N here. 38 If you are unsure about this, say N here.
39 39
40endmenu
41
42config SYS_HYPERVISOR 40config SYS_HYPERVISOR
43 bool 41 bool
44 default n 42 default n
43
44endmenu
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index bc6602606fb5..6ffe2b2bdacc 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1992,8 +1992,8 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
1992 *block_size = BLOCK_SIZE; 1992 *block_size = BLOCK_SIZE;
1993 } 1993 }
1994 if (*total_size != (__u32) 0) 1994 if (*total_size != (__u32) 0)
1995 printk(KERN_INFO " blocks= %lld block_size= %d\n", 1995 printk(KERN_INFO " blocks= %llu block_size= %d\n",
1996 *total_size, *block_size); 1996 (unsigned long long)*total_size, *block_size);
1997 kfree(buf); 1997 kfree(buf);
1998 return; 1998 return;
1999} 1999}
@@ -2027,8 +2027,8 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2027 *total_size = 0; 2027 *total_size = 0;
2028 *block_size = BLOCK_SIZE; 2028 *block_size = BLOCK_SIZE;
2029 } 2029 }
2030 printk(KERN_INFO " blocks= %lld block_size= %d\n", 2030 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2031 *total_size, *block_size); 2031 (unsigned long long)*total_size, *block_size);
2032 kfree(buf); 2032 kfree(buf);
2033 return; 2033 return;
2034} 2034}
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c
index d8d0f28e0acf..e3239833e4b0 100644
--- a/drivers/char/watchdog/sc1200wdt.c
+++ b/drivers/char/watchdog/sc1200wdt.c
@@ -392,7 +392,7 @@ static int __init sc1200wdt_init(void)
392 if (io == -1) { 392 if (io == -1) {
393 printk(KERN_ERR PFX "io parameter must be specified\n"); 393 printk(KERN_ERR PFX "io parameter must be specified\n");
394 ret = -EINVAL; 394 ret = -EINVAL;
395 goto out_clean; 395 goto out_pnp;
396 } 396 }
397 397
398#if defined CONFIG_PNP 398#if defined CONFIG_PNP
@@ -405,7 +405,7 @@ static int __init sc1200wdt_init(void)
405 if (!request_region(io, io_len, SC1200_MODULE_NAME)) { 405 if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
406 printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); 406 printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
407 ret = -EBUSY; 407 ret = -EBUSY;
408 goto out_clean; 408 goto out_pnp;
409 } 409 }
410 410
411 ret = sc1200wdt_probe(); 411 ret = sc1200wdt_probe();
@@ -435,6 +435,11 @@ out_rbt:
435out_io: 435out_io:
436 release_region(io, io_len); 436 release_region(io, io_len);
437 437
438out_pnp:
439#if defined CONFIG_PNP
440 if (isapnp)
441 pnp_unregister_driver(&scl200wdt_pnp_driver);
442#endif
438 goto out_clean; 443 goto out_clean;
439} 444}
440 445
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index ad418ce882ca..e72ab36a5494 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -247,8 +247,10 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
247 (!(PCI_FUNC(dev->devfn) & 1))) 247 (!(PCI_FUNC(dev->devfn) & 1)))
248 goto out; 248 goto out;
249 249
250 if (dev->vendor == PCI_VENDOR_ID_JMICRON && PCI_FUNC(dev->devfn) != 1) 250 if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
251 goto out; 251 if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
252 goto out;
253 }
252 254
253 if (dev->vendor != PCI_VENDOR_ID_JMICRON) { 255 if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
254 pci_read_config_word(dev, PCI_COMMAND, &command); 256 pci_read_config_word(dev, PCI_COMMAND, &command);
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index dea13525df88..6e8ea9110c46 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -3552,12 +3552,21 @@ static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
3552{ 3552{
3553 int err; 3553 int err;
3554 3554
3555 printk(KERN_INFO "%s does not fully support suspend and resume yet\n",
3556 OHCI1394_DRIVER_NAME);
3557
3555 err = pci_save_state(pdev); 3558 err = pci_save_state(pdev);
3556 if (err) 3559 if (err) {
3557 goto out; 3560 printk(KERN_ERR "%s: pci_save_state failed with %d\n",
3561 OHCI1394_DRIVER_NAME, err);
3562 return err;
3563 }
3558 err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3564 err = pci_set_power_state(pdev, pci_choose_state(pdev, state));
3565#ifdef OHCI1394_DEBUG
3559 if (err) 3566 if (err)
3560 goto out; 3567 printk(KERN_DEBUG "%s: pci_set_power_state failed with %d\n",
3568 OHCI1394_DRIVER_NAME, err);
3569#endif /* OHCI1394_DEBUG */
3561 3570
3562/* PowerMac suspend code comes last */ 3571/* PowerMac suspend code comes last */
3563#ifdef CONFIG_PPC_PMAC 3572#ifdef CONFIG_PPC_PMAC
@@ -3570,8 +3579,8 @@ static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
3570 pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0); 3579 pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0);
3571 } 3580 }
3572#endif /* CONFIG_PPC_PMAC */ 3581#endif /* CONFIG_PPC_PMAC */
3573out: 3582
3574 return err; 3583 return 0;
3575} 3584}
3576#endif /* CONFIG_PM */ 3585#endif /* CONFIG_PM */
3577 3586
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7daa7b1e145f..50ab4a936e30 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2003,6 +2003,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
2003 kobject_init(&rdev->kobj); 2003 kobject_init(&rdev->kobj);
2004 2004
2005 rdev->desc_nr = -1; 2005 rdev->desc_nr = -1;
2006 rdev->saved_raid_disk = -1;
2006 rdev->flags = 0; 2007 rdev->flags = 0;
2007 rdev->data_offset = 0; 2008 rdev->data_offset = 0;
2008 rdev->sb_events = 0; 2009 rdev->sb_events = 0;
@@ -4044,11 +4045,8 @@ static int update_size(mddev_t *mddev, unsigned long size)
4044 return -EBUSY; 4045 return -EBUSY;
4045 ITERATE_RDEV(mddev,rdev,tmp) { 4046 ITERATE_RDEV(mddev,rdev,tmp) {
4046 sector_t avail; 4047 sector_t avail;
4047 if (rdev->sb_offset > rdev->data_offset) 4048 avail = rdev->size * 2;
4048 avail = (rdev->sb_offset*2) - rdev->data_offset; 4049
4049 else
4050 avail = get_capacity(rdev->bdev->bd_disk)
4051 - rdev->data_offset;
4052 if (fit && (size == 0 || size > avail/2)) 4050 if (fit && (size == 0 || size > avail/2))
4053 size = avail/2; 4051 size = avail/2;
4054 if (avail < ((sector_t)size << 1)) 4052 if (avail < ((sector_t)size << 1))
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index a6260f0e3b9e..14da37fee37b 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -277,6 +277,7 @@ static void multipath_error (mddev_t *mddev, mdk_rdev_t *rdev)
277 set_bit(Faulty, &rdev->flags); 277 set_bit(Faulty, &rdev->flags);
278 set_bit(MD_CHANGE_DEVS, &mddev->flags); 278 set_bit(MD_CHANGE_DEVS, &mddev->flags);
279 conf->working_disks--; 279 conf->working_disks--;
280 mddev->degraded++;
280 printk(KERN_ALERT "multipath: IO failure on %s," 281 printk(KERN_ALERT "multipath: IO failure on %s,"
281 " disabling IO path. \n Operation continuing" 282 " disabling IO path. \n Operation continuing"
282 " on %d IO paths.\n", 283 " on %d IO paths.\n",
@@ -336,6 +337,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
336 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); 337 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);
337 338
338 conf->working_disks++; 339 conf->working_disks++;
340 mddev->degraded--;
339 rdev->raid_disk = path; 341 rdev->raid_disk = path;
340 set_bit(In_sync, &rdev->flags); 342 set_bit(In_sync, &rdev->flags);
341 rcu_assign_pointer(p->rdev, rdev); 343 rcu_assign_pointer(p->rdev, rdev);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index dc9d2def0270..656fae912fe3 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1474,8 +1474,8 @@ static void fix_read_error(conf_t *conf, int read_disk,
1474 "raid1:%s: read error corrected " 1474 "raid1:%s: read error corrected "
1475 "(%d sectors at %llu on %s)\n", 1475 "(%d sectors at %llu on %s)\n",
1476 mdname(mddev), s, 1476 mdname(mddev), s,
1477 (unsigned long long)sect + 1477 (unsigned long long)(sect +
1478 rdev->data_offset, 1478 rdev->data_offset),
1479 bdevname(rdev->bdev, b)); 1479 bdevname(rdev->bdev, b));
1480 } 1480 }
1481 } 1481 }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 74f17a9a6ebb..7492d6033ac6 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1470,8 +1470,8 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
1470 "raid10:%s: read error corrected" 1470 "raid10:%s: read error corrected"
1471 " (%d sectors at %llu on %s)\n", 1471 " (%d sectors at %llu on %s)\n",
1472 mdname(mddev), s, 1472 mdname(mddev), s,
1473 (unsigned long long)sect+ 1473 (unsigned long long)(sect+
1474 rdev->data_offset, 1474 rdev->data_offset),
1475 bdevname(rdev->bdev, b)); 1475 bdevname(rdev->bdev, b));
1476 1476
1477 rdev_dec_pending(rdev, mddev); 1477 rdev_dec_pending(rdev, mddev);
diff --git a/drivers/misc/ioc4.c b/drivers/misc/ioc4.c
index 79354bbbbd6a..b995a15b7526 100644
--- a/drivers/misc/ioc4.c
+++ b/drivers/misc/ioc4.c
@@ -210,8 +210,8 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
210 210
211 do_div(ns, IOC4_EXTINT_COUNT_DIVISOR); 211 do_div(ns, IOC4_EXTINT_COUNT_DIVISOR);
212 printk(KERN_DEBUG 212 printk(KERN_DEBUG
213 "IOC4 %s: PCI clock is %lld ns.\n", 213 "IOC4 %s: PCI clock is %llu ns.\n",
214 pci_name(idd->idd_pdev), ns); 214 pci_name(idd->idd_pdev), (unsigned long long)ns);
215 } 215 }
216 216
217 /* Remember results. We store the extint clock period rather 217 /* Remember results. We store the extint clock period rather
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 686d895116de..f63909e4bc32 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -887,6 +887,13 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
887 PCMCIA_DEVICE_PROD_ID123( 887 PCMCIA_DEVICE_PROD_ID123(
888 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02", 888 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
889 0xc7b8df9d, 0x1700d087, 0x4b74baa0), 889 0xc7b8df9d, 0x1700d087, 0x4b74baa0),
890 PCMCIA_DEVICE_PROD_ID123(
891 "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
892 "Ver. 1.00",
893 0x5cd01705, 0x4271660f, 0x9d08ee12),
894 PCMCIA_DEVICE_PROD_ID123(
895 "corega", "WL PCCL-11", "ISL37300P",
896 0xa21501a, 0x59868926, 0xc9049a39),
890 PCMCIA_DEVICE_NULL 897 PCMCIA_DEVICE_NULL
891}; 898};
892MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); 899MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 7f5df9a9f393..3bcb7dc32995 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -241,12 +241,6 @@ static int __init at91_cf_probe(struct platform_device *pdev)
241 csa = at91_sys_read(AT91_EBI_CSA); 241 csa = at91_sys_read(AT91_EBI_CSA);
242 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); 242 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
243 243
244 /* force poweron defaults for these pins ... */
245 (void) at91_set_A_periph(AT91_PIN_PC9, 0); /* A25/CFRNW */
246 (void) at91_set_A_periph(AT91_PIN_PC10, 0); /* NCS4/CFCS */
247 (void) at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */
248 (void) at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */
249
250 /* nWAIT is _not_ a default setting */ 244 /* nWAIT is _not_ a default setting */
251 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ 245 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
252 246
@@ -316,12 +310,14 @@ static int __init at91_cf_probe(struct platform_device *pdev)
316 return 0; 310 return 0;
317 311
318fail2: 312fail2:
319 iounmap((void __iomem *) cf->socket.io_offset);
320 release_mem_region(io->start, io->end + 1 - io->start); 313 release_mem_region(io->start, io->end + 1 - io->start);
321fail1: 314fail1:
315 if (cf->socket.io_offset)
316 iounmap((void __iomem *) cf->socket.io_offset);
322 if (board->irq_pin) 317 if (board->irq_pin)
323 free_irq(board->irq_pin, cf); 318 free_irq(board->irq_pin, cf);
324fail0a: 319fail0a:
320 device_init_wakeup(&pdev->dev, 0);
325 free_irq(board->det_pin, cf); 321 free_irq(board->det_pin, cf);
326 device_init_wakeup(&pdev->dev, 0); 322 device_init_wakeup(&pdev->dev, 0);
327fail0: 323fail0:
@@ -360,26 +356,20 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
360 struct at91_cf_data *board = cf->board; 356 struct at91_cf_data *board = cf->board;
361 357
362 pcmcia_socket_dev_suspend(&pdev->dev, mesg); 358 pcmcia_socket_dev_suspend(&pdev->dev, mesg);
363 if (device_may_wakeup(&pdev->dev)) 359 if (device_may_wakeup(&pdev->dev)) {
364 enable_irq_wake(board->det_pin); 360 enable_irq_wake(board->det_pin);
365 else { 361 if (board->irq_pin)
362 enable_irq_wake(board->irq_pin);
363 } else {
366 disable_irq_wake(board->det_pin); 364 disable_irq_wake(board->det_pin);
367 disable_irq(board->det_pin); 365 if (board->irq_pin)
366 disable_irq_wake(board->irq_pin);
368 } 367 }
369 if (board->irq_pin)
370 disable_irq(board->irq_pin);
371 return 0; 368 return 0;
372} 369}
373 370
374static int at91_cf_resume(struct platform_device *pdev) 371static int at91_cf_resume(struct platform_device *pdev)
375{ 372{
376 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
377 struct at91_cf_data *board = cf->board;
378
379 if (board->irq_pin)
380 enable_irq(board->irq_pin);
381 if (!device_may_wakeup(&pdev->dev))
382 enable_irq(board->det_pin);
383 pcmcia_socket_dev_resume(&pdev->dev); 373 pcmcia_socket_dev_resume(&pdev->dev);
384 return 0; 374 return 0;
385} 375}
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index d5dd0ce65536..551bde5d9430 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -351,6 +351,7 @@ struct skt_dev_info {
351int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) 351int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
352{ 352{
353 struct skt_dev_info *sinfo; 353 struct skt_dev_info *sinfo;
354 struct au1000_pcmcia_socket *skt;
354 int ret, i; 355 int ret, i;
355 356
356 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL); 357 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL);
@@ -365,7 +366,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
365 * Initialise the per-socket structure. 366 * Initialise the per-socket structure.
366 */ 367 */
367 for (i = 0; i < nr; i++) { 368 for (i = 0; i < nr; i++) {
368 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 369 skt = PCMCIA_SOCKET(i);
369 memset(skt, 0, sizeof(*skt)); 370 memset(skt, 0, sizeof(*skt));
370 371
371 skt->socket.resource_ops = &pccard_static_ops; 372 skt->socket.resource_ops = &pccard_static_ops;
@@ -438,17 +439,29 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
438 dev_set_drvdata(dev, sinfo); 439 dev_set_drvdata(dev, sinfo);
439 return 0; 440 return 0;
440 441
441 do { 442
442 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 443out_err:
444 flush_scheduled_work();
445 ops->hw_shutdown(skt);
446 while (i-- > 0) {
447 skt = PCMCIA_SOCKET(i);
443 448
444 del_timer_sync(&skt->poll_timer); 449 del_timer_sync(&skt->poll_timer);
445 pcmcia_unregister_socket(&skt->socket); 450 pcmcia_unregister_socket(&skt->socket);
446out_err:
447 flush_scheduled_work(); 451 flush_scheduled_work();
452 if (i == 0) {
453 iounmap(skt->virt_io + (u32)mips_io_port_base);
454 skt->virt_io = NULL;
455 }
456#ifndef CONFIG_MIPS_XXS1500
457 else {
458 iounmap(skt->virt_io + (u32)mips_io_port_base);
459 skt->virt_io = NULL;
460 }
461#endif
448 ops->hw_shutdown(skt); 462 ops->hw_shutdown(skt);
449 463
450 i--; 464 }
451 } while (i > 0);
452 kfree(sinfo); 465 kfree(sinfo);
453out: 466out:
454 return ret; 467 return ret;
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 74b3124e8247..0f701921c13e 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -717,6 +717,7 @@ static int pcmcia_requery(struct device *dev, void * _data)
717static void pcmcia_bus_rescan(struct pcmcia_socket *skt) 717static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
718{ 718{
719 int no_devices=0; 719 int no_devices=0;
720 int ret = 0;
720 unsigned long flags; 721 unsigned long flags;
721 722
722 /* must be called with skt_mutex held */ 723 /* must be called with skt_mutex held */
@@ -729,7 +730,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
729 * missing resource information or other trouble, we need to 730 * missing resource information or other trouble, we need to
730 * do this now. */ 731 * do this now. */
731 if (no_devices) { 732 if (no_devices) {
732 int ret = pcmcia_card_add(skt); 733 ret = pcmcia_card_add(skt);
733 if (ret) 734 if (ret)
734 return; 735 return;
735 } 736 }
@@ -741,7 +742,9 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt)
741 742
742 /* we re-scan all devices, not just the ones connected to this 743 /* we re-scan all devices, not just the ones connected to this
743 * socket. This does not matter, though. */ 744 * socket. This does not matter, though. */
744 bus_rescan_devices(&pcmcia_bus_type); 745 ret = bus_rescan_devices(&pcmcia_bus_type);
746 if (ret)
747 printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n");
745} 748}
746 749
747static inline int pcmcia_devmatch(struct pcmcia_device *dev, 750static inline int pcmcia_devmatch(struct pcmcia_device *dev,
@@ -1001,6 +1004,7 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
1001 struct device_attribute *attr, const char *buf, size_t count) 1004 struct device_attribute *attr, const char *buf, size_t count)
1002{ 1005{
1003 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1006 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1007 int ret;
1004 1008
1005 if (!count) 1009 if (!count)
1006 return -EINVAL; 1010 return -EINVAL;
@@ -1009,7 +1013,10 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
1009 p_dev->allow_func_id_match = 1; 1013 p_dev->allow_func_id_match = 1;
1010 mutex_unlock(&p_dev->socket->skt_mutex); 1014 mutex_unlock(&p_dev->socket->skt_mutex);
1011 1015
1012 bus_rescan_devices(&pcmcia_bus_type); 1016 ret = bus_rescan_devices(&pcmcia_bus_type);
1017 if (ret)
1018 printk(KERN_INFO "pcmcia: bus_rescan_devices failed after "
1019 "allowing func_id matches\n");
1013 1020
1014 return count; 1021 return count;
1015} 1022}
@@ -1292,10 +1299,22 @@ struct bus_type pcmcia_bus_type = {
1292 1299
1293static int __init init_pcmcia_bus(void) 1300static int __init init_pcmcia_bus(void)
1294{ 1301{
1302 int ret;
1303
1295 spin_lock_init(&pcmcia_dev_list_lock); 1304 spin_lock_init(&pcmcia_dev_list_lock);
1296 1305
1297 bus_register(&pcmcia_bus_type); 1306 ret = bus_register(&pcmcia_bus_type);
1298 class_interface_register(&pcmcia_bus_interface); 1307 if (ret < 0) {
1308 printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret);
1309 return ret;
1310 }
1311 ret = class_interface_register(&pcmcia_bus_interface);
1312 if (ret < 0) {
1313 printk(KERN_WARNING
1314 "pcmcia: class_interface_register error: %d\n", ret);
1315 bus_unregister(&pcmcia_bus_type);
1316 return ret;
1317 }
1299 1318
1300 pcmcia_setup_ioctl(); 1319 pcmcia_setup_ioctl();
1301 1320
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index 82715f448957..c2ea07aa7a12 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -41,6 +41,7 @@ static struct pci_device_id i82092aa_pci_ids[] = {
41}; 41};
42MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); 42MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
43 43
44#ifdef CONFIG_PM
44static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state) 45static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
45{ 46{
46 return pcmcia_socket_dev_suspend(&dev->dev, state); 47 return pcmcia_socket_dev_suspend(&dev->dev, state);
@@ -50,14 +51,17 @@ static int i82092aa_socket_resume (struct pci_dev *dev)
50{ 51{
51 return pcmcia_socket_dev_resume(&dev->dev); 52 return pcmcia_socket_dev_resume(&dev->dev);
52} 53}
54#endif
53 55
54static struct pci_driver i82092aa_pci_drv = { 56static struct pci_driver i82092aa_pci_drv = {
55 .name = "i82092aa", 57 .name = "i82092aa",
56 .id_table = i82092aa_pci_ids, 58 .id_table = i82092aa_pci_ids,
57 .probe = i82092aa_pci_probe, 59 .probe = i82092aa_pci_probe,
58 .remove = __devexit_p(i82092aa_pci_remove), 60 .remove = __devexit_p(i82092aa_pci_remove),
61#ifdef CONFIG_PM
59 .suspend = i82092aa_socket_suspend, 62 .suspend = i82092aa_socket_suspend,
60 .resume = i82092aa_socket_resume, 63 .resume = i82092aa_socket_resume,
64#endif
61}; 65};
62 66
63 67
@@ -705,10 +709,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
705 709
706static int i82092aa_module_init(void) 710static int i82092aa_module_init(void)
707{ 711{
708 enter("i82092aa_module_init"); 712 return pci_register_driver(&i82092aa_pci_drv);
709 pci_register_driver(&i82092aa_pci_drv);
710 leave("i82092aa_module_init");
711 return 0;
712} 713}
713 714
714static void i82092aa_module_exit(void) 715static void i82092aa_module_exit(void)
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index e070a2896769..3b72be880401 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -427,7 +427,7 @@ static int voltage_set(int slot, int vcc, int vpp)
427 reg |= BCSR1_PCCVCC1; 427 reg |= BCSR1_PCCVCC1;
428 break; 428 break;
429 default: 429 default:
430 return 1; 430 goto out_unmap;
431 } 431 }
432 432
433 switch(vpp) { 433 switch(vpp) {
@@ -438,15 +438,15 @@ static int voltage_set(int slot, int vcc, int vpp)
438 if(vcc == vpp) 438 if(vcc == vpp)
439 reg |= BCSR1_PCCVPP1; 439 reg |= BCSR1_PCCVPP1;
440 else 440 else
441 return 1; 441 goto out_unmap;
442 break; 442 break;
443 case 120: 443 case 120:
444 if ((vcc == 33) || (vcc == 50)) 444 if ((vcc == 33) || (vcc == 50))
445 reg |= BCSR1_PCCVPP0; 445 reg |= BCSR1_PCCVPP0;
446 else 446 else
447 return 1; 447 goto out_unmap;
448 default: 448 default:
449 return 1; 449 goto out_unmap;
450 } 450 }
451 451
452 /* first, turn off all power */ 452 /* first, turn off all power */
@@ -457,6 +457,10 @@ static int voltage_set(int slot, int vcc, int vpp)
457 457
458 iounmap(bcsr_io); 458 iounmap(bcsr_io);
459 return 0; 459 return 0;
460
461out_unmap:
462 iounmap(bcsr_io);
463 return 1;
460} 464}
461 465
462#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V 466#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index c8e838c69766..06bf7f48836e 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -309,9 +309,10 @@ static int __devinit omap_cf_probe(struct device *dev)
309 return 0; 309 return 0;
310 310
311fail2: 311fail2:
312 iounmap((void __iomem *) cf->socket.io_offset);
313 release_mem_region(cf->phys_cf, SZ_8K); 312 release_mem_region(cf->phys_cf, SZ_8K);
314fail1: 313fail1:
314 if (cf->socket.io_offset)
315 iounmap((void __iomem *) cf->socket.io_offset);
315 free_irq(irq, cf); 316 free_irq(irq, cf);
316fail0: 317fail0:
317 kfree(cf); 318 kfree(cf);
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 9ad18e62658d..310ede575caa 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos,
128 int count, int *eof, void *data) 128 int count, int *eof, void *data)
129{ 129{
130 char *p = buf; 130 char *p = buf;
131 int rc;
131 132
132 bus_for_each_drv(&pcmcia_bus_type, NULL, 133 rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
133 (void *) &p, proc_read_drivers_callback); 134 (void *) &p, proc_read_drivers_callback);
135 if (rc < 0)
136 return rc;
134 137
135 return (p - buf); 138 return (p - buf);
136} 139}
@@ -269,8 +272,10 @@ rescan:
269 * Prevent this racing with a card insertion. 272 * Prevent this racing with a card insertion.
270 */ 273 */
271 mutex_lock(&s->skt_mutex); 274 mutex_lock(&s->skt_mutex);
272 bus_rescan_devices(&pcmcia_bus_type); 275 ret = bus_rescan_devices(&pcmcia_bus_type);
273 mutex_unlock(&s->skt_mutex); 276 mutex_unlock(&s->skt_mutex);
277 if (ret)
278 goto err_put_module;
274 279
275 /* check whether the driver indeed matched. I don't care if this 280 /* check whether the driver indeed matched. I don't care if this
276 * is racy or not, because it can only happen on cardmgr access 281 * is racy or not, because it can only happen on cardmgr access
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 74cebd424032..b9201c2ec38b 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -95,7 +95,7 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
95 * potential conflicts, just the most obvious ones. 95 * potential conflicts, just the most obvious ones.
96 */ 96 */
97 for (i = 0; i < MAX_IO_WIN; i++) 97 for (i = 0; i < MAX_IO_WIN; i++)
98 if ((s->io[i].res) && 98 if ((s->io[i].res) && *base &&
99 ((s->io[i].res->start & (align-1)) == *base)) 99 ((s->io[i].res->start & (align-1)) == *base))
100 return 1; 100 return 1;
101 for (i = 0; i < MAX_IO_WIN; i++) { 101 for (i = 0; i < MAX_IO_WIN; i++) {
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index c83a0a6b158f..a70f97fdbbdd 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -755,6 +755,7 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev)
755 kfree(socket); 755 kfree(socket);
756} 756}
757 757
758#ifdef CONFIG_PM
758static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state) 759static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state)
759{ 760{
760 return pcmcia_socket_dev_suspend(&dev->dev, state); 761 return pcmcia_socket_dev_suspend(&dev->dev, state);
@@ -764,6 +765,7 @@ static int pd6729_socket_resume(struct pci_dev *dev)
764{ 765{
765 return pcmcia_socket_dev_resume(&dev->dev); 766 return pcmcia_socket_dev_resume(&dev->dev);
766} 767}
768#endif
767 769
768static struct pci_device_id pd6729_pci_ids[] = { 770static struct pci_device_id pd6729_pci_ids[] = {
769 { 771 {
@@ -781,8 +783,10 @@ static struct pci_driver pd6729_pci_drv = {
781 .id_table = pd6729_pci_ids, 783 .id_table = pd6729_pci_ids,
782 .probe = pd6729_pci_probe, 784 .probe = pd6729_pci_probe,
783 .remove = __devexit_p(pd6729_pci_remove), 785 .remove = __devexit_p(pd6729_pci_remove),
786#ifdef CONFIG_PM
784 .suspend = pd6729_socket_suspend, 787 .suspend = pd6729_socket_suspend,
785 .resume = pd6729_socket_resume, 788 .resume = pd6729_socket_resume,
789#endif
786}; 790};
787 791
788static int pd6729_module_init(void) 792static int pd6729_module_init(void)
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 3627e52e0c27..e433704e026a 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -824,3 +824,4 @@ int soc_common_drv_pcmcia_remove(struct device *dev)
824 824
825 return 0; 825 return 0;
826} 826}
827EXPORT_SYMBOL(soc_common_drv_pcmcia_remove);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 26229d9da762..da471bddc972 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1197,8 +1197,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1197 ret = pcmcia_register_socket(&socket->socket); 1197 ret = pcmcia_register_socket(&socket->socket);
1198 if (ret == 0) { 1198 if (ret == 0) {
1199 /* Add the yenta register attributes */ 1199 /* Add the yenta register attributes */
1200 device_create_file(&dev->dev, &dev_attr_yenta_registers); 1200 ret = device_create_file(&dev->dev, &dev_attr_yenta_registers);
1201 goto out; 1201 if (ret == 0)
1202 goto out;
1203
1204 /* error path... */
1205 pcmcia_unregister_socket(&socket->socket);
1202 } 1206 }
1203 1207
1204 unmap: 1208 unmap:
@@ -1213,7 +1217,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1213 return ret; 1217 return ret;
1214} 1218}
1215 1219
1216 1220#ifdef CONFIG_PM
1217static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) 1221static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state)
1218{ 1222{
1219 struct yenta_socket *socket = pci_get_drvdata(dev); 1223 struct yenta_socket *socket = pci_get_drvdata(dev);
@@ -1248,12 +1252,18 @@ static int yenta_dev_resume (struct pci_dev *dev)
1248 struct yenta_socket *socket = pci_get_drvdata(dev); 1252 struct yenta_socket *socket = pci_get_drvdata(dev);
1249 1253
1250 if (socket) { 1254 if (socket) {
1255 int rc;
1256
1251 pci_set_power_state(dev, 0); 1257 pci_set_power_state(dev, 0);
1252 /* FIXME: pci_restore_state needs to have a better interface */ 1258 /* FIXME: pci_restore_state needs to have a better interface */
1253 pci_restore_state(dev); 1259 pci_restore_state(dev);
1254 pci_write_config_dword(dev, 16*4, socket->saved_state[0]); 1260 pci_write_config_dword(dev, 16*4, socket->saved_state[0]);
1255 pci_write_config_dword(dev, 17*4, socket->saved_state[1]); 1261 pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
1256 pci_enable_device(dev); 1262
1263 rc = pci_enable_device(dev);
1264 if (rc)
1265 return rc;
1266
1257 pci_set_master(dev); 1267 pci_set_master(dev);
1258 1268
1259 if (socket->type && socket->type->restore_state) 1269 if (socket->type && socket->type->restore_state)
@@ -1262,7 +1272,7 @@ static int yenta_dev_resume (struct pci_dev *dev)
1262 1272
1263 return pcmcia_socket_dev_resume(&dev->dev); 1273 return pcmcia_socket_dev_resume(&dev->dev);
1264} 1274}
1265 1275#endif
1266 1276
1267#define CB_ID(vend,dev,type) \ 1277#define CB_ID(vend,dev,type) \
1268 { \ 1278 { \
@@ -1359,8 +1369,10 @@ static struct pci_driver yenta_cardbus_driver = {
1359 .id_table = yenta_table, 1369 .id_table = yenta_table,
1360 .probe = yenta_probe, 1370 .probe = yenta_probe,
1361 .remove = __devexit_p(yenta_close), 1371 .remove = __devexit_p(yenta_close),
1372#ifdef CONFIG_PM
1362 .suspend = yenta_dev_suspend, 1373 .suspend = yenta_dev_suspend,
1363 .resume = yenta_dev_resume, 1374 .resume = yenta_dev_resume,
1375#endif
1364}; 1376};
1365 1377
1366 1378
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index a2dee5bf5a17..ad7f7e1c0163 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -271,10 +271,6 @@ static int css_evaluate_known_subchannel(struct subchannel *sch, int slow)
271 /* Reset intparm to zeroes. */ 271 /* Reset intparm to zeroes. */
272 sch->schib.pmcw.intparm = 0; 272 sch->schib.pmcw.intparm = 0;
273 cio_modify(sch); 273 cio_modify(sch);
274
275 /* Probe if necessary. */
276 if (action == UNREGISTER_PROBE)
277 ret = css_probe_device(sch->schid);
278 break; 274 break;
279 case REPROBE: 275 case REPROBE:
280 device_trigger_reprobe(sch); 276 device_trigger_reprobe(sch);
@@ -283,6 +279,9 @@ static int css_evaluate_known_subchannel(struct subchannel *sch, int slow)
283 break; 279 break;
284 } 280 }
285 spin_unlock_irqrestore(&sch->lock, flags); 281 spin_unlock_irqrestore(&sch->lock, flags);
282 /* Probe if necessary. */
283 if (action == UNREGISTER_PROBE)
284 ret = css_probe_device(sch->schid);
286 285
287 return ret; 286 return ret;
288} 287}
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 94bdd4d8a4c9..39c98f940507 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -532,8 +532,7 @@ device_remove_files(struct device *dev)
532 532
533/* this is a simple abstraction for device_register that sets the 533/* this is a simple abstraction for device_register that sets the
534 * correct bus type and adds the bus specific files */ 534 * correct bus type and adds the bus specific files */
535int 535static int ccw_device_register(struct ccw_device *cdev)
536ccw_device_register(struct ccw_device *cdev)
537{ 536{
538 struct device *dev = &cdev->dev; 537 struct device *dev = &cdev->dev;
539 int ret; 538 int ret;
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h
index c6140cc97a80..9233b5c0bcc8 100644
--- a/drivers/s390/cio/device.h
+++ b/drivers/s390/cio/device.h
@@ -78,7 +78,6 @@ void io_subchannel_recog_done(struct ccw_device *cdev);
78 78
79int ccw_device_cancel_halt_clear(struct ccw_device *); 79int ccw_device_cancel_halt_clear(struct ccw_device *);
80 80
81int ccw_device_register(struct ccw_device *);
82void ccw_device_do_unreg_rereg(void *); 81void ccw_device_do_unreg_rereg(void *);
83void ccw_device_call_sch_unregister(void *); 82void ccw_device_call_sch_unregister(void *);
84 83
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index c5ccd20b110c..79d89c368919 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -739,11 +739,16 @@ static void ap_scan_bus(void *data)
739 dev = bus_find_device(&ap_bus_type, NULL, 739 dev = bus_find_device(&ap_bus_type, NULL,
740 (void *)(unsigned long)qid, 740 (void *)(unsigned long)qid,
741 __ap_scan_bus); 741 __ap_scan_bus);
742 rc = ap_query_queue(qid, &queue_depth, &device_type);
743 if (dev && rc) {
744 put_device(dev);
745 device_unregister(dev);
746 continue;
747 }
742 if (dev) { 748 if (dev) {
743 put_device(dev); 749 put_device(dev);
744 continue; 750 continue;
745 } 751 }
746 rc = ap_query_queue(qid, &queue_depth, &device_type);
747 if (rc) 752 if (rc)
748 continue; 753 continue;
749 rc = ap_init_queue(qid); 754 rc = ap_init_queue(qid);
diff --git a/fs/block_dev.c b/fs/block_dev.c
index bc8f27cc4483..702b88cbd91d 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1131,6 +1131,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
1131 filp->f_flags |= O_LARGEFILE; 1131 filp->f_flags |= O_LARGEFILE;
1132 1132
1133 bdev = bd_acquire(inode); 1133 bdev = bd_acquire(inode);
1134 if (bdev == NULL)
1135 return -ENOMEM;
1134 1136
1135 res = do_open(bdev, filp, BD_MUTEX_NORMAL); 1137 res = do_open(bdev, filp, BD_MUTEX_NORMAL);
1136 if (res) 1138 if (res)
diff --git a/fs/dcache.c b/fs/dcache.c
index a1ff91eef108..fd4a428998ef 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -478,11 +478,12 @@ static void prune_dcache(int count, struct super_block *sb)
478 up_read(s_umount); 478 up_read(s_umount);
479 } 479 }
480 spin_unlock(&dentry->d_lock); 480 spin_unlock(&dentry->d_lock);
481 /* Cannot remove the first dentry, and it isn't appropriate 481 /*
482 * to move it to the head of the list, so give up, and try 482 * Insert dentry at the head of the list as inserting at the
483 * later 483 * tail leads to a cycle.
484 */ 484 */
485 break; 485 list_add(&dentry->d_lru, &dentry_unused);
486 dentry_stat.nr_unused++;
486 } 487 }
487 spin_unlock(&dcache_lock); 488 spin_unlock(&dcache_lock);
488} 489}
@@ -556,6 +557,7 @@ repeat:
556static void shrink_dcache_for_umount_subtree(struct dentry *dentry) 557static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
557{ 558{
558 struct dentry *parent; 559 struct dentry *parent;
560 unsigned detached = 0;
559 561
560 BUG_ON(!IS_ROOT(dentry)); 562 BUG_ON(!IS_ROOT(dentry));
561 563
@@ -620,7 +622,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
620 atomic_dec(&parent->d_count); 622 atomic_dec(&parent->d_count);
621 623
622 list_del(&dentry->d_u.d_child); 624 list_del(&dentry->d_u.d_child);
623 dentry_stat.nr_dentry--; /* For d_free, below */ 625 detached++;
624 626
625 inode = dentry->d_inode; 627 inode = dentry->d_inode;
626 if (inode) { 628 if (inode) {
@@ -638,7 +640,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
638 * otherwise we ascend to the parent and move to the 640 * otherwise we ascend to the parent and move to the
639 * next sibling if there is one */ 641 * next sibling if there is one */
640 if (!parent) 642 if (!parent)
641 return; 643 goto out;
642 644
643 dentry = parent; 645 dentry = parent;
644 646
@@ -647,6 +649,11 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry)
647 dentry = list_entry(dentry->d_subdirs.next, 649 dentry = list_entry(dentry->d_subdirs.next,
648 struct dentry, d_u.d_child); 650 struct dentry, d_u.d_child);
649 } 651 }
652out:
653 /* several dentries were freed, need to correct nr_dentry */
654 spin_lock(&dcache_lock);
655 dentry_stat.nr_dentry -= detached;
656 spin_unlock(&dcache_lock);
650} 657}
651 658
652/* 659/*
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 1e9578052cd3..4fe49c3661b2 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -69,44 +69,49 @@ static int verify_group_input(struct super_block *sb,
69 else if (outside(input->block_bitmap, start, end)) 69 else if (outside(input->block_bitmap, start, end))
70 ext4_warning(sb, __FUNCTION__, 70 ext4_warning(sb, __FUNCTION__,
71 "Block bitmap not in group (block %llu)", 71 "Block bitmap not in group (block %llu)",
72 input->block_bitmap); 72 (unsigned long long)input->block_bitmap);
73 else if (outside(input->inode_bitmap, start, end)) 73 else if (outside(input->inode_bitmap, start, end))
74 ext4_warning(sb, __FUNCTION__, 74 ext4_warning(sb, __FUNCTION__,
75 "Inode bitmap not in group (block %llu)", 75 "Inode bitmap not in group (block %llu)",
76 input->inode_bitmap); 76 (unsigned long long)input->inode_bitmap);
77 else if (outside(input->inode_table, start, end) || 77 else if (outside(input->inode_table, start, end) ||
78 outside(itend - 1, start, end)) 78 outside(itend - 1, start, end))
79 ext4_warning(sb, __FUNCTION__, 79 ext4_warning(sb, __FUNCTION__,
80 "Inode table not in group (blocks %llu-%llu)", 80 "Inode table not in group (blocks %llu-%llu)",
81 input->inode_table, itend - 1); 81 (unsigned long long)input->inode_table, itend - 1);
82 else if (input->inode_bitmap == input->block_bitmap) 82 else if (input->inode_bitmap == input->block_bitmap)
83 ext4_warning(sb, __FUNCTION__, 83 ext4_warning(sb, __FUNCTION__,
84 "Block bitmap same as inode bitmap (%llu)", 84 "Block bitmap same as inode bitmap (%llu)",
85 input->block_bitmap); 85 (unsigned long long)input->block_bitmap);
86 else if (inside(input->block_bitmap, input->inode_table, itend)) 86 else if (inside(input->block_bitmap, input->inode_table, itend))
87 ext4_warning(sb, __FUNCTION__, 87 ext4_warning(sb, __FUNCTION__,
88 "Block bitmap (%llu) in inode table (%llu-%llu)", 88 "Block bitmap (%llu) in inode table (%llu-%llu)",
89 input->block_bitmap, input->inode_table, itend-1); 89 (unsigned long long)input->block_bitmap,
90 (unsigned long long)input->inode_table, itend - 1);
90 else if (inside(input->inode_bitmap, input->inode_table, itend)) 91 else if (inside(input->inode_bitmap, input->inode_table, itend))
91 ext4_warning(sb, __FUNCTION__, 92 ext4_warning(sb, __FUNCTION__,
92 "Inode bitmap (%llu) in inode table (%llu-%llu)", 93 "Inode bitmap (%llu) in inode table (%llu-%llu)",
93 input->inode_bitmap, input->inode_table, itend-1); 94 (unsigned long long)input->inode_bitmap,
95 (unsigned long long)input->inode_table, itend - 1);
94 else if (inside(input->block_bitmap, start, metaend)) 96 else if (inside(input->block_bitmap, start, metaend))
95 ext4_warning(sb, __FUNCTION__, 97 ext4_warning(sb, __FUNCTION__,
96 "Block bitmap (%llu) in GDT table" 98 "Block bitmap (%llu) in GDT table"
97 " (%llu-%llu)", 99 " (%llu-%llu)",
98 input->block_bitmap, start, metaend - 1); 100 (unsigned long long)input->block_bitmap,
101 start, metaend - 1);
99 else if (inside(input->inode_bitmap, start, metaend)) 102 else if (inside(input->inode_bitmap, start, metaend))
100 ext4_warning(sb, __FUNCTION__, 103 ext4_warning(sb, __FUNCTION__,
101 "Inode bitmap (%llu) in GDT table" 104 "Inode bitmap (%llu) in GDT table"
102 " (%llu-%llu)", 105 " (%llu-%llu)",
103 input->inode_bitmap, start, metaend - 1); 106 (unsigned long long)input->inode_bitmap,
107 start, metaend - 1);
104 else if (inside(input->inode_table, start, metaend) || 108 else if (inside(input->inode_table, start, metaend) ||
105 inside(itend - 1, start, metaend)) 109 inside(itend - 1, start, metaend))
106 ext4_warning(sb, __FUNCTION__, 110 ext4_warning(sb, __FUNCTION__,
107 "Inode table (%llu-%llu) overlaps" 111 "Inode table (%llu-%llu) overlaps"
108 "GDT table (%llu-%llu)", 112 "GDT table (%llu-%llu)",
109 input->inode_table, itend - 1, start, metaend - 1); 113 (unsigned long long)input->inode_table,
114 itend - 1, start, metaend - 1);
110 else 115 else
111 err = 0; 116 err = 0;
112 brelse(bh); 117 brelse(bh);
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 4ee3f006b861..0bea6a619e10 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -271,26 +271,24 @@ static void hugetlbfs_drop_inode(struct inode *inode)
271 hugetlbfs_forget_inode(inode); 271 hugetlbfs_forget_inode(inode);
272} 272}
273 273
274/*
275 * h_pgoff is in HPAGE_SIZE units.
276 * vma->vm_pgoff is in PAGE_SIZE units.
277 */
278static inline void 274static inline void
279hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff) 275hugetlb_vmtruncate_list(struct prio_tree_root *root, pgoff_t pgoff)
280{ 276{
281 struct vm_area_struct *vma; 277 struct vm_area_struct *vma;
282 struct prio_tree_iter iter; 278 struct prio_tree_iter iter;
283 279
284 vma_prio_tree_foreach(vma, &iter, root, h_pgoff, ULONG_MAX) { 280 vma_prio_tree_foreach(vma, &iter, root, pgoff, ULONG_MAX) {
285 unsigned long h_vm_pgoff;
286 unsigned long v_offset; 281 unsigned long v_offset;
287 282
288 h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
289 v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
290 /* 283 /*
291 * Is this VMA fully outside the truncation point? 284 * Can the expression below overflow on 32-bit arches?
285 * No, because the prio_tree returns us only those vmas
286 * which overlap the truncated area starting at pgoff,
287 * and no vma on a 32-bit arch can span beyond the 4GB.
292 */ 288 */
293 if (h_vm_pgoff >= h_pgoff) 289 if (vma->vm_pgoff < pgoff)
290 v_offset = (pgoff - vma->vm_pgoff) << PAGE_SHIFT;
291 else
294 v_offset = 0; 292 v_offset = 0;
295 293
296 __unmap_hugepage_range(vma, 294 __unmap_hugepage_range(vma,
@@ -303,14 +301,14 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
303 */ 301 */
304static int hugetlb_vmtruncate(struct inode *inode, loff_t offset) 302static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
305{ 303{
306 unsigned long pgoff; 304 pgoff_t pgoff;
307 struct address_space *mapping = inode->i_mapping; 305 struct address_space *mapping = inode->i_mapping;
308 306
309 if (offset > inode->i_size) 307 if (offset > inode->i_size)
310 return -EINVAL; 308 return -EINVAL;
311 309
312 BUG_ON(offset & ~HPAGE_MASK); 310 BUG_ON(offset & ~HPAGE_MASK);
313 pgoff = offset >> HPAGE_SHIFT; 311 pgoff = offset >> PAGE_SHIFT;
314 312
315 inode->i_size = offset; 313 inode->i_size = offset;
316 spin_lock(&mapping->i_mmap_lock); 314 spin_lock(&mapping->i_mmap_lock);
@@ -624,7 +622,6 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
624 do_div(size, 100); 622 do_div(size, 100);
625 rest++; 623 rest++;
626 } 624 }
627 size &= HPAGE_MASK;
628 pconfig->nr_blocks = (size >> HPAGE_SHIFT); 625 pconfig->nr_blocks = (size >> HPAGE_SHIFT);
629 value = rest; 626 value = rest;
630 } else if (!strcmp(opt,"nr_inodes")) { 627 } else if (!strcmp(opt,"nr_inodes")) {
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index d5c63047a8b3..4f82bcd63e48 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -967,6 +967,13 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
967 */ 967 */
968 jbd_lock_bh_state(bh); 968 jbd_lock_bh_state(bh);
969 spin_lock(&journal->j_list_lock); 969 spin_lock(&journal->j_list_lock);
970
971 /* Now that we have bh_state locked, are we really still mapped? */
972 if (!buffer_mapped(bh)) {
973 JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
974 goto no_journal;
975 }
976
970 if (jh->b_transaction) { 977 if (jh->b_transaction) {
971 JBUFFER_TRACE(jh, "has transaction"); 978 JBUFFER_TRACE(jh, "has transaction");
972 if (jh->b_transaction != handle->h_transaction) { 979 if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1035,11 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1028 sync_dirty_buffer(bh); 1035 sync_dirty_buffer(bh);
1029 jbd_lock_bh_state(bh); 1036 jbd_lock_bh_state(bh);
1030 spin_lock(&journal->j_list_lock); 1037 spin_lock(&journal->j_list_lock);
1038 /* Since we dropped the lock... */
1039 if (!buffer_mapped(bh)) {
1040 JBUFFER_TRACE(jh, "buffer got unmapped");
1041 goto no_journal;
1042 }
1031 /* The buffer may become locked again at any 1043 /* The buffer may become locked again at any
1032 time if it is redirtied */ 1044 time if it is redirtied */
1033 } 1045 }
@@ -1824,6 +1836,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1824 } 1836 }
1825 } 1837 }
1826 } else if (transaction == journal->j_committing_transaction) { 1838 } else if (transaction == journal->j_committing_transaction) {
1839 JBUFFER_TRACE(jh, "on committing transaction");
1827 if (jh->b_jlist == BJ_Locked) { 1840 if (jh->b_jlist == BJ_Locked) {
1828 /* 1841 /*
1829 * The buffer is on the committing transaction's locked 1842 * The buffer is on the committing transaction's locked
@@ -1838,7 +1851,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1838 * can remove it's next_transaction pointer from the 1851 * can remove it's next_transaction pointer from the
1839 * running transaction if that is set, but nothing 1852 * running transaction if that is set, but nothing
1840 * else. */ 1853 * else. */
1841 JBUFFER_TRACE(jh, "on committing transaction");
1842 set_buffer_freed(bh); 1854 set_buffer_freed(bh);
1843 if (jh->b_next_transaction) { 1855 if (jh->b_next_transaction) {
1844 J_ASSERT(jh->b_next_transaction == 1856 J_ASSERT(jh->b_next_transaction ==
@@ -1858,6 +1870,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1858 * i_size already for this truncate so recovery will not 1870 * i_size already for this truncate so recovery will not
1859 * expose the disk blocks we are discarding here.) */ 1871 * expose the disk blocks we are discarding here.) */
1860 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); 1872 J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
1873 JBUFFER_TRACE(jh, "on running transaction");
1861 may_free = __dispose_buffer(jh, transaction); 1874 may_free = __dispose_buffer(jh, transaction);
1862 } 1875 }
1863 1876
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index b6cf2be845a1..c051a94c8a97 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -967,6 +967,13 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
967 */ 967 */
968 jbd_lock_bh_state(bh); 968 jbd_lock_bh_state(bh);
969 spin_lock(&journal->j_list_lock); 969 spin_lock(&journal->j_list_lock);
970
971 /* Now that we have bh_state locked, are we really still mapped? */
972 if (!buffer_mapped(bh)) {
973 JBUFFER_TRACE(jh, "unmapped buffer, bailing out");
974 goto no_journal;
975 }
976
970 if (jh->b_transaction) { 977 if (jh->b_transaction) {
971 JBUFFER_TRACE(jh, "has transaction"); 978 JBUFFER_TRACE(jh, "has transaction");
972 if (jh->b_transaction != handle->h_transaction) { 979 if (jh->b_transaction != handle->h_transaction) {
@@ -1028,6 +1035,11 @@ int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1028 sync_dirty_buffer(bh); 1035 sync_dirty_buffer(bh);
1029 jbd_lock_bh_state(bh); 1036 jbd_lock_bh_state(bh);
1030 spin_lock(&journal->j_list_lock); 1037 spin_lock(&journal->j_list_lock);
1038 /* Since we dropped the lock... */
1039 if (!buffer_mapped(bh)) {
1040 JBUFFER_TRACE(jh, "buffer got unmapped");
1041 goto no_journal;
1042 }
1031 /* The buffer may become locked again at any 1043 /* The buffer may become locked again at any
1032 time if it is redirtied */ 1044 time if it is redirtied */
1033 } 1045 }
@@ -1824,6 +1836,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1824 } 1836 }
1825 } 1837 }
1826 } else if (transaction == journal->j_committing_transaction) { 1838 } else if (transaction == journal->j_committing_transaction) {
1839 JBUFFER_TRACE(jh, "on committing transaction");
1827 if (jh->b_jlist == BJ_Locked) { 1840 if (jh->b_jlist == BJ_Locked) {
1828 /* 1841 /*
1829 * The buffer is on the committing transaction's locked 1842 * The buffer is on the committing transaction's locked
@@ -1838,7 +1851,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1838 * can remove it's next_transaction pointer from the 1851 * can remove it's next_transaction pointer from the
1839 * running transaction if that is set, but nothing 1852 * running transaction if that is set, but nothing
1840 * else. */ 1853 * else. */
1841 JBUFFER_TRACE(jh, "on committing transaction");
1842 set_buffer_freed(bh); 1854 set_buffer_freed(bh);
1843 if (jh->b_next_transaction) { 1855 if (jh->b_next_transaction) {
1844 J_ASSERT(jh->b_next_transaction == 1856 J_ASSERT(jh->b_next_transaction ==
@@ -1858,6 +1870,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
1858 * i_size already for this truncate so recovery will not 1870 * i_size already for this truncate so recovery will not
1859 * expose the disk blocks we are discarding here.) */ 1871 * expose the disk blocks we are discarding here.) */
1860 J_ASSERT_JH(jh, transaction == journal->j_running_transaction); 1872 J_ASSERT_JH(jh, transaction == journal->j_running_transaction);
1873 JBUFFER_TRACE(jh, "on running transaction");
1861 may_free = __dispose_buffer(jh, transaction); 1874 may_free = __dispose_buffer(jh, transaction);
1862 } 1875 }
1863 1876
diff --git a/fs/splice.c b/fs/splice.c
index 49fb9f129938..8d705954d294 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -74,7 +74,7 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe,
74 wait_on_page_writeback(page); 74 wait_on_page_writeback(page);
75 75
76 if (PagePrivate(page)) 76 if (PagePrivate(page))
77 try_to_release_page(page, mapping_gfp_mask(mapping)); 77 try_to_release_page(page, GFP_KERNEL);
78 78
79 /* 79 /*
80 * If we succeeded in removing the mapping, set LRU flag 80 * If we succeeded in removing the mapping, set LRU flag
@@ -333,7 +333,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
333 break; 333 break;
334 334
335 error = add_to_page_cache_lru(page, mapping, index, 335 error = add_to_page_cache_lru(page, mapping, index,
336 mapping_gfp_mask(mapping)); 336 GFP_KERNEL);
337 if (unlikely(error)) { 337 if (unlikely(error)) {
338 page_cache_release(page); 338 page_cache_release(page);
339 if (error == -EEXIST) 339 if (error == -EEXIST)
@@ -557,7 +557,6 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
557{ 557{
558 struct file *file = sd->file; 558 struct file *file = sd->file;
559 struct address_space *mapping = file->f_mapping; 559 struct address_space *mapping = file->f_mapping;
560 gfp_t gfp_mask = mapping_gfp_mask(mapping);
561 unsigned int offset, this_len; 560 unsigned int offset, this_len;
562 struct page *page; 561 struct page *page;
563 pgoff_t index; 562 pgoff_t index;
@@ -591,7 +590,7 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
591 goto find_page; 590 goto find_page;
592 591
593 page = buf->page; 592 page = buf->page;
594 if (add_to_page_cache(page, mapping, index, gfp_mask)) { 593 if (add_to_page_cache(page, mapping, index, GFP_KERNEL)) {
595 unlock_page(page); 594 unlock_page(page);
596 goto find_page; 595 goto find_page;
597 } 596 }
@@ -613,7 +612,7 @@ find_page:
613 * This will also lock the page 612 * This will also lock the page
614 */ 613 */
615 ret = add_to_page_cache_lru(page, mapping, index, 614 ret = add_to_page_cache_lru(page, mapping, index,
616 gfp_mask); 615 GFP_KERNEL);
617 if (unlikely(ret)) 616 if (unlikely(ret))
618 goto out; 617 goto out;
619 } 618 }
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
deleted file mode 100644
index 21cd696d4d0f..000000000000
--- a/include/asm-i386/mach-visws/do_timer.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* defines for inline arch setup functions */
2
3#include <asm/fixmap.h>
4#include <asm/i8259.h>
5#include "cobalt.h"
6
7static inline void do_timer_interrupt_hook(void)
8{
9 /* Clear the interrupt */
10 co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
11
12 do_timer(1);
13#ifndef CONFIG_SMP
14 update_process_times(user_mode_vm(irq_regs));
15#endif
16/*
17 * In the SMP case we use the local APIC timer interrupt to do the
18 * profiling, except when we simulate SMP mode on a uniprocessor
19 * system, in that case we have to call the local interrupt handler.
20 */
21#ifndef CONFIG_X86_LOCAL_APIC
22 profile_tick(CPU_PROFILING);
23#else
24 if (!using_apic_timer)
25 smp_local_timer_interrupt();
26#endif
27}
28
29static inline int do_timer_overflow(int count)
30{
31 int i;
32
33 spin_lock(&i8259A_lock);
34 /*
35 * This is tricky when I/O APICs are used;
36 * see do_timer_interrupt().
37 */
38 i = inb(0x20);
39 spin_unlock(&i8259A_lock);
40
41 /* assumption about timer being IRQ0 */
42 if (i & 0x01) {
43 /*
44 * We cannot detect lost timer interrupts ...
45 * well, that's why we call them lost, don't we? :)
46 * [hmm, on the Pentium and Alpha we can ... sort of]
47 */
48 count -= LATCH;
49 } else {
50 printk("do_slow_gettimeoffset(): hardware timer problem?\n");
51 }
52 return count;
53}
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h
index de438c7147a8..18afe6b6fc4d 100644
--- a/include/asm-i386/mach-visws/mach_apic.h
+++ b/include/asm-i386/mach-visws/mach_apic.h
@@ -51,6 +51,11 @@ static inline void clustered_apic_check(void)
51{ 51{
52} 52}
53 53
54static inline int apicid_to_node(int logical_apicid)
55{
56 return 0;
57}
58
54/* Mapping from cpu number to logical apicid */ 59/* Mapping from cpu number to logical apicid */
55static inline int cpu_to_logical_apicid(int cpu) 60static inline int cpu_to_logical_apicid(int cpu)
56{ 61{
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f4ebf96f5308..f1553196826f 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -196,7 +196,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
196#define BITS_TO_COMPAT_LONGS(bits) \ 196#define BITS_TO_COMPAT_LONGS(bits) \
197 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG) 197 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
198 198
199long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, 199long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
200 unsigned long bitmap_size); 200 unsigned long bitmap_size);
201long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, 201long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
202 unsigned long bitmap_size); 202 unsigned long bitmap_size);
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ed0762b283a9..e06683e2bea3 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -218,13 +218,9 @@ struct zone {
218 * under - it drives the swappiness decision: whether to unmap mapped 218 * under - it drives the swappiness decision: whether to unmap mapped
219 * pages. 219 * pages.
220 * 220 *
221 * temp_priority is used to remember the scanning priority at which 221 * Access to both this field is quite racy even on uniprocessor. But
222 * this zone was successfully refilled to free_pages == pages_high.
223 *
224 * Access to both these fields is quite racy even on uniprocessor. But
225 * it is expected to average out OK. 222 * it is expected to average out OK.
226 */ 223 */
227 int temp_priority;
228 int prev_priority; 224 int prev_priority;
229 225
230 226
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 64f950925151..c3e255bf8594 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,19 +52,23 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
52void release_pages(struct page **pages, int nr, int cold); 52void release_pages(struct page **pages, int nr, int cold);
53 53
54#ifdef CONFIG_NUMA 54#ifdef CONFIG_NUMA
55extern struct page *page_cache_alloc(struct address_space *x); 55extern struct page *__page_cache_alloc(gfp_t gfp);
56extern struct page *page_cache_alloc_cold(struct address_space *x);
57#else 56#else
57static inline struct page *__page_cache_alloc(gfp_t gfp)
58{
59 return alloc_pages(gfp, 0);
60}
61#endif
62
58static inline struct page *page_cache_alloc(struct address_space *x) 63static inline struct page *page_cache_alloc(struct address_space *x)
59{ 64{
60 return alloc_pages(mapping_gfp_mask(x), 0); 65 return __page_cache_alloc(mapping_gfp_mask(x));
61} 66}
62 67
63static inline struct page *page_cache_alloc_cold(struct address_space *x) 68static inline struct page *page_cache_alloc_cold(struct address_space *x)
64{ 69{
65 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 70 return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD);
66} 71}
67#endif
68 72
69typedef int filler_t(void *, struct page *); 73typedef int filler_t(void *, struct page *);
70 74
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6735c1cf334c..eafe4a7b8237 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -466,7 +466,6 @@ struct signal_struct {
466 struct pacct_struct pacct; /* per-process accounting information */ 466 struct pacct_struct pacct; /* per-process accounting information */
467#endif 467#endif
468#ifdef CONFIG_TASKSTATS 468#ifdef CONFIG_TASKSTATS
469 spinlock_t stats_lock;
470 struct taskstats *stats; 469 struct taskstats *stats;
471#endif 470#endif
472}; 471};
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 16894b7edcc8..6562a2050a25 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -23,25 +23,26 @@ static inline void taskstats_exit_free(struct taskstats *tidstats)
23 23
24static inline void taskstats_tgid_init(struct signal_struct *sig) 24static inline void taskstats_tgid_init(struct signal_struct *sig)
25{ 25{
26 spin_lock_init(&sig->stats_lock);
27 sig->stats = NULL; 26 sig->stats = NULL;
28} 27}
29 28
30static inline void taskstats_tgid_alloc(struct signal_struct *sig) 29static inline void taskstats_tgid_alloc(struct task_struct *tsk)
31{ 30{
31 struct signal_struct *sig = tsk->signal;
32 struct taskstats *stats; 32 struct taskstats *stats;
33 unsigned long flags;
34 33
35 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); 34 if (sig->stats != NULL)
36 if (!stats)
37 return; 35 return;
38 36
39 spin_lock_irqsave(&sig->stats_lock, flags); 37 /* No problem if kmem_cache_zalloc() fails */
38 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
39
40 spin_lock_irq(&tsk->sighand->siglock);
40 if (!sig->stats) { 41 if (!sig->stats) {
41 sig->stats = stats; 42 sig->stats = stats;
42 stats = NULL; 43 stats = NULL;
43 } 44 }
44 spin_unlock_irqrestore(&sig->stats_lock, flags); 45 spin_unlock_irq(&tsk->sighand->siglock);
45 46
46 if (stats) 47 if (stats)
47 kmem_cache_free(taskstats_cache, stats); 48 kmem_cache_free(taskstats_cache, stats);
@@ -49,23 +50,13 @@ static inline void taskstats_tgid_alloc(struct signal_struct *sig)
49 50
50static inline void taskstats_tgid_free(struct signal_struct *sig) 51static inline void taskstats_tgid_free(struct signal_struct *sig)
51{ 52{
52 struct taskstats *stats = NULL; 53 if (sig->stats)
53 unsigned long flags; 54 kmem_cache_free(taskstats_cache, sig->stats);
54
55 spin_lock_irqsave(&sig->stats_lock, flags);
56 if (sig->stats) {
57 stats = sig->stats;
58 sig->stats = NULL;
59 }
60 spin_unlock_irqrestore(&sig->stats_lock, flags);
61 if (stats)
62 kmem_cache_free(taskstats_cache, stats);
63} 55}
64 56
65extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); 57extern void taskstats_exit_alloc(struct taskstats **, unsigned int *);
66extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int); 58extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
67extern void taskstats_init_early(void); 59extern void taskstats_init_early(void);
68extern void taskstats_tgid_alloc(struct signal_struct *);
69#else 60#else
70static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu) 61static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu)
71{} 62{}
@@ -77,7 +68,7 @@ static inline void taskstats_exit_send(struct task_struct *tsk,
77{} 68{}
78static inline void taskstats_tgid_init(struct signal_struct *sig) 69static inline void taskstats_tgid_init(struct signal_struct *sig)
79{} 70{}
80static inline void taskstats_tgid_alloc(struct signal_struct *sig) 71static inline void taskstats_tgid_alloc(struct task_struct *tsk)
81{} 72{}
82static inline void taskstats_tgid_free(struct signal_struct *sig) 73static inline void taskstats_tgid_free(struct signal_struct *sig)
83{} 74{}
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index ce5f1482e6be..dc9a29d84abc 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -60,7 +60,8 @@ extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
60extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 60extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
61 unsigned long start, unsigned long end); 61 unsigned long start, unsigned long end);
62extern struct vm_struct *get_vm_area_node(unsigned long size, 62extern struct vm_struct *get_vm_area_node(unsigned long size,
63 unsigned long flags, int node); 63 unsigned long flags, int node,
64 gfp_t gfp_mask);
64extern struct vm_struct *remove_vm_area(void *addr); 65extern struct vm_struct *remove_vm_area(void *addr);
65extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 66extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
66 struct page ***pages); 67 struct page ***pages);
diff --git a/kernel/compat.c b/kernel/compat.c
index 75573e5d27b0..d4898aad6cfa 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -678,7 +678,7 @@ int get_compat_sigevent(struct sigevent *event,
678 ? -EFAULT : 0; 678 ? -EFAULT : 0;
679} 679}
680 680
681long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, 681long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
682 unsigned long bitmap_size) 682 unsigned long bitmap_size)
683{ 683{
684 int i, j; 684 int i, j;
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 27dd3ee47099..663c920b2234 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -150,18 +150,18 @@ static int _cpu_down(unsigned int cpu)
150 p = __stop_machine_run(take_cpu_down, NULL, cpu); 150 p = __stop_machine_run(take_cpu_down, NULL, cpu);
151 mutex_unlock(&cpu_bitmask_lock); 151 mutex_unlock(&cpu_bitmask_lock);
152 152
153 if (IS_ERR(p)) { 153 if (IS_ERR(p) || cpu_online(cpu)) {
154 /* CPU didn't die: tell everyone. Can't complain. */ 154 /* CPU didn't die: tell everyone. Can't complain. */
155 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, 155 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
156 (void *)(long)cpu) == NOTIFY_BAD) 156 (void *)(long)cpu) == NOTIFY_BAD)
157 BUG(); 157 BUG();
158 158
159 err = PTR_ERR(p); 159 if (IS_ERR(p)) {
160 goto out_allowed; 160 err = PTR_ERR(p);
161 } 161 goto out_allowed;
162 162 }
163 if (cpu_online(cpu))
164 goto out_thread; 163 goto out_thread;
164 }
165 165
166 /* Wait for it to sleep (leaving idle task). */ 166 /* Wait for it to sleep (leaving idle task). */
167 while (!idle_cpu(cpu)) 167 while (!idle_cpu(cpu))
diff --git a/kernel/exit.c b/kernel/exit.c
index f250a5e3e281..06de6c4e8ca3 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -128,6 +128,7 @@ static void __exit_signal(struct task_struct *tsk)
128 flush_sigqueue(&tsk->pending); 128 flush_sigqueue(&tsk->pending);
129 if (sig) { 129 if (sig) {
130 flush_sigqueue(&sig->shared_pending); 130 flush_sigqueue(&sig->shared_pending);
131 taskstats_tgid_free(sig);
131 __cleanup_signal(sig); 132 __cleanup_signal(sig);
132 } 133 }
133} 134}
diff --git a/kernel/fork.c b/kernel/fork.c
index 29ebb30850ed..3da978eec791 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -830,7 +830,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
830 if (clone_flags & CLONE_THREAD) { 830 if (clone_flags & CLONE_THREAD) {
831 atomic_inc(&current->signal->count); 831 atomic_inc(&current->signal->count);
832 atomic_inc(&current->signal->live); 832 atomic_inc(&current->signal->live);
833 taskstats_tgid_alloc(current->signal); 833 taskstats_tgid_alloc(current);
834 return 0; 834 return 0;
835 } 835 }
836 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); 836 sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
@@ -897,7 +897,6 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts
897void __cleanup_signal(struct signal_struct *sig) 897void __cleanup_signal(struct signal_struct *sig)
898{ 898{
899 exit_thread_group_keys(sig); 899 exit_thread_group_keys(sig);
900 taskstats_tgid_free(sig);
901 kmem_cache_free(signal_cachep, sig); 900 kmem_cache_free(signal_cachep, sig);
902} 901}
903 902
diff --git a/kernel/module.c b/kernel/module.c
index 67009bd56c52..5072a943fe35 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1342,7 +1342,7 @@ static void set_license(struct module *mod, const char *license)
1342 1342
1343 if (!license_is_gpl_compatible(license)) { 1343 if (!license_is_gpl_compatible(license)) {
1344 if (!(tainted & TAINT_PROPRIETARY_MODULE)) 1344 if (!(tainted & TAINT_PROPRIETARY_MODULE))
1345 printk(KERN_WARNING "%s: module license '%s' taints" 1345 printk(KERN_WARNING "%s: module license '%s' taints "
1346 "kernel.\n", mod->name, license); 1346 "kernel.\n", mod->name, license);
1347 add_taint_module(mod, TAINT_PROPRIETARY_MODULE); 1347 add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
1348 } 1348 }
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 5d6a8c54ee85..2039585ec5e1 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -77,7 +77,8 @@ static int prepare_reply(struct genl_info *info, u8 cmd, struct sk_buff **skbp,
77 /* 77 /*
78 * If new attributes are added, please revisit this allocation 78 * If new attributes are added, please revisit this allocation
79 */ 79 */
80 skb = nlmsg_new(genlmsg_total_size(size), GFP_KERNEL); 80 size = nlmsg_total_size(genlmsg_total_size(size));
81 skb = nlmsg_new(size, GFP_KERNEL);
81 if (!skb) 82 if (!skb)
82 return -ENOMEM; 83 return -ENOMEM;
83 84
@@ -174,21 +175,19 @@ static void send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
174 up_write(&listeners->sem); 175 up_write(&listeners->sem);
175} 176}
176 177
177static int fill_pid(pid_t pid, struct task_struct *pidtsk, 178static int fill_pid(pid_t pid, struct task_struct *tsk,
178 struct taskstats *stats) 179 struct taskstats *stats)
179{ 180{
180 int rc = 0; 181 int rc = 0;
181 struct task_struct *tsk = pidtsk;
182 182
183 if (!pidtsk) { 183 if (!tsk) {
184 read_lock(&tasklist_lock); 184 rcu_read_lock();
185 tsk = find_task_by_pid(pid); 185 tsk = find_task_by_pid(pid);
186 if (!tsk) { 186 if (tsk)
187 read_unlock(&tasklist_lock); 187 get_task_struct(tsk);
188 rcu_read_unlock();
189 if (!tsk)
188 return -ESRCH; 190 return -ESRCH;
189 }
190 get_task_struct(tsk);
191 read_unlock(&tasklist_lock);
192 } else 191 } else
193 get_task_struct(tsk); 192 get_task_struct(tsk);
194 193
@@ -214,39 +213,30 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
214 213
215} 214}
216 215
217static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk, 216static int fill_tgid(pid_t tgid, struct task_struct *first,
218 struct taskstats *stats) 217 struct taskstats *stats)
219{ 218{
220 struct task_struct *tsk, *first; 219 struct task_struct *tsk;
221 unsigned long flags; 220 unsigned long flags;
221 int rc = -ESRCH;
222 222
223 /* 223 /*
224 * Add additional stats from live tasks except zombie thread group 224 * Add additional stats from live tasks except zombie thread group
225 * leaders who are already counted with the dead tasks 225 * leaders who are already counted with the dead tasks
226 */ 226 */
227 first = tgidtsk; 227 rcu_read_lock();
228 if (!first) { 228 if (!first)
229 read_lock(&tasklist_lock);
230 first = find_task_by_pid(tgid); 229 first = find_task_by_pid(tgid);
231 if (!first) {
232 read_unlock(&tasklist_lock);
233 return -ESRCH;
234 }
235 get_task_struct(first);
236 read_unlock(&tasklist_lock);
237 } else
238 get_task_struct(first);
239 230
240 /* Start with stats from dead tasks */ 231 if (!first || !lock_task_sighand(first, &flags))
241 spin_lock_irqsave(&first->signal->stats_lock, flags); 232 goto out;
233
242 if (first->signal->stats) 234 if (first->signal->stats)
243 memcpy(stats, first->signal->stats, sizeof(*stats)); 235 memcpy(stats, first->signal->stats, sizeof(*stats));
244 spin_unlock_irqrestore(&first->signal->stats_lock, flags);
245 236
246 tsk = first; 237 tsk = first;
247 read_lock(&tasklist_lock);
248 do { 238 do {
249 if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk)) 239 if (tsk->exit_state)
250 continue; 240 continue;
251 /* 241 /*
252 * Accounting subsystem can call its functions here to 242 * Accounting subsystem can call its functions here to
@@ -257,15 +247,18 @@ static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk,
257 delayacct_add_tsk(stats, tsk); 247 delayacct_add_tsk(stats, tsk);
258 248
259 } while_each_thread(first, tsk); 249 } while_each_thread(first, tsk);
260 read_unlock(&tasklist_lock);
261 stats->version = TASKSTATS_VERSION;
262 250
251 unlock_task_sighand(first, &flags);
252 rc = 0;
253out:
254 rcu_read_unlock();
255
256 stats->version = TASKSTATS_VERSION;
263 /* 257 /*
264 * Accounting subsytems can also add calls here to modify 258 * Accounting subsytems can also add calls here to modify
265 * fields of taskstats. 259 * fields of taskstats.
266 */ 260 */
267 261 return rc;
268 return 0;
269} 262}
270 263
271 264
@@ -273,7 +266,7 @@ static void fill_tgid_exit(struct task_struct *tsk)
273{ 266{
274 unsigned long flags; 267 unsigned long flags;
275 268
276 spin_lock_irqsave(&tsk->signal->stats_lock, flags); 269 spin_lock_irqsave(&tsk->sighand->siglock, flags);
277 if (!tsk->signal->stats) 270 if (!tsk->signal->stats)
278 goto ret; 271 goto ret;
279 272
@@ -285,7 +278,7 @@ static void fill_tgid_exit(struct task_struct *tsk)
285 */ 278 */
286 delayacct_add_tsk(tsk->signal->stats, tsk); 279 delayacct_add_tsk(tsk->signal->stats, tsk);
287ret: 280ret:
288 spin_unlock_irqrestore(&tsk->signal->stats_lock, flags); 281 spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
289 return; 282 return;
290} 283}
291 284
@@ -419,7 +412,7 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
419 return send_reply(rep_skb, info->snd_pid); 412 return send_reply(rep_skb, info->snd_pid);
420 413
421nla_put_failure: 414nla_put_failure:
422 return genlmsg_cancel(rep_skb, reply); 415 rc = genlmsg_cancel(rep_skb, reply);
423err: 416err:
424 nlmsg_free(rep_skb); 417 nlmsg_free(rep_skb);
425 return rc; 418 return rc;
@@ -461,15 +454,10 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
461 size_t size; 454 size_t size;
462 int is_thread_group; 455 int is_thread_group;
463 struct nlattr *na; 456 struct nlattr *na;
464 unsigned long flags;
465 457
466 if (!family_registered || !tidstats) 458 if (!family_registered || !tidstats)
467 return; 459 return;
468 460
469 spin_lock_irqsave(&tsk->signal->stats_lock, flags);
470 is_thread_group = tsk->signal->stats ? 1 : 0;
471 spin_unlock_irqrestore(&tsk->signal->stats_lock, flags);
472
473 rc = 0; 461 rc = 0;
474 /* 462 /*
475 * Size includes space for nested attributes 463 * Size includes space for nested attributes
@@ -477,6 +465,7 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
477 size = nla_total_size(sizeof(u32)) + 465 size = nla_total_size(sizeof(u32)) +
478 nla_total_size(sizeof(struct taskstats)) + nla_total_size(0); 466 nla_total_size(sizeof(struct taskstats)) + nla_total_size(0);
479 467
468 is_thread_group = (tsk->signal->stats != NULL);
480 if (is_thread_group) 469 if (is_thread_group)
481 size = 2 * size; /* PID + STATS + TGID + STATS */ 470 size = 2 * size; /* PID + STATS + TGID + STATS */
482 471
@@ -519,7 +508,6 @@ send:
519 508
520nla_put_failure: 509nla_put_failure:
521 genlmsg_cancel(rep_skb, reply); 510 genlmsg_cancel(rep_skb, reply);
522 goto ret;
523err_skb: 511err_skb:
524 nlmsg_free(rep_skb); 512 nlmsg_free(rep_skb);
525ret: 513ret:
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 47195fa0ec4f..3afeaa3a73f9 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -161,9 +161,9 @@ void second_overflow(void)
161 time_adjust += MAX_TICKADJ; 161 time_adjust += MAX_TICKADJ;
162 tick_length -= MAX_TICKADJ_SCALED; 162 tick_length -= MAX_TICKADJ_SCALED;
163 } else { 163 } else {
164 time_adjust = 0;
165 tick_length += (s64)(time_adjust * NSEC_PER_USEC / 164 tick_length += (s64)(time_adjust * NSEC_PER_USEC /
166 HZ) << TICK_LENGTH_SHIFT; 165 HZ) << TICK_LENGTH_SHIFT;
166 time_adjust = 0;
167 } 167 }
168 } 168 }
169} 169}
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index db443221ba5b..65a5036a3d95 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -36,7 +36,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
36 36
37 /* calculate task elapsed time in timespec */ 37 /* calculate task elapsed time in timespec */
38 do_posix_clock_monotonic_gettime(&uptime); 38 do_posix_clock_monotonic_gettime(&uptime);
39 ts = timespec_sub(uptime, current->group_leader->start_time); 39 ts = timespec_sub(uptime, tsk->start_time);
40 /* rebase elapsed time to usec */ 40 /* rebase elapsed time to usec */
41 ac_etime = timespec_to_ns(&ts); 41 ac_etime = timespec_to_ns(&ts);
42 do_div(ac_etime, NSEC_PER_USEC); 42 do_div(ac_etime, NSEC_PER_USEC);
@@ -58,7 +58,10 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
58 stats->ac_uid = tsk->uid; 58 stats->ac_uid = tsk->uid;
59 stats->ac_gid = tsk->gid; 59 stats->ac_gid = tsk->gid;
60 stats->ac_pid = tsk->pid; 60 stats->ac_pid = tsk->pid;
61 stats->ac_ppid = (tsk->parent) ? tsk->parent->pid : 0; 61 rcu_read_lock();
62 stats->ac_ppid = pid_alive(tsk) ?
63 rcu_dereference(tsk->real_parent)->tgid : 0;
64 rcu_read_unlock();
62 stats->ac_utime = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC; 65 stats->ac_utime = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC;
63 stats->ac_stime = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC; 66 stats->ac_stime = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC;
64 stats->ac_minflt = tsk->min_flt; 67 stats->ac_minflt = tsk->min_flt;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 3df9bfc7ff78..17c2f03d2c27 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -99,7 +99,7 @@ static void __queue_work(struct cpu_workqueue_struct *cwq,
99 * @wq: workqueue to use 99 * @wq: workqueue to use
100 * @work: work to queue 100 * @work: work to queue
101 * 101 *
102 * Returns non-zero if it was successfully added. 102 * Returns 0 if @work was already on a queue, non-zero otherwise.
103 * 103 *
104 * We queue the work to the CPU it was submitted, but there is no 104 * We queue the work to the CPU it was submitted, but there is no
105 * guarantee that it will be processed by that CPU. 105 * guarantee that it will be processed by that CPU.
@@ -138,7 +138,7 @@ static void delayed_work_timer_fn(unsigned long __data)
138 * @work: work to queue 138 * @work: work to queue
139 * @delay: number of jiffies to wait before queueing 139 * @delay: number of jiffies to wait before queueing
140 * 140 *
141 * Returns non-zero if it was successfully added. 141 * Returns 0 if @work was already on a queue, non-zero otherwise.
142 */ 142 */
143int fastcall queue_delayed_work(struct workqueue_struct *wq, 143int fastcall queue_delayed_work(struct workqueue_struct *wq,
144 struct work_struct *work, unsigned long delay) 144 struct work_struct *work, unsigned long delay)
@@ -169,7 +169,7 @@ EXPORT_SYMBOL_GPL(queue_delayed_work);
169 * @work: work to queue 169 * @work: work to queue
170 * @delay: number of jiffies to wait before queueing 170 * @delay: number of jiffies to wait before queueing
171 * 171 *
172 * Returns non-zero if it was successfully added. 172 * Returns 0 if @work was already on a queue, non-zero otherwise.
173 */ 173 */
174int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 174int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
175 struct work_struct *work, unsigned long delay) 175 struct work_struct *work, unsigned long delay)
diff --git a/lib/string.c b/lib/string.c
index 63077267367e..a485d75962af 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -320,7 +320,7 @@ char *strstrip(char *s)
320 return s; 320 return s;
321 321
322 end = s + size - 1; 322 end = s + size - 1;
323 while (end != s && isspace(*end)) 323 while (end >= s && isspace(*end))
324 end--; 324 end--;
325 *(end + 1) = '\0'; 325 *(end + 1) = '\0';
326 326
diff --git a/mm/filemap.c b/mm/filemap.c
index cb26e33fd0ff..7b84dc814347 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -467,25 +467,15 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
467} 467}
468 468
469#ifdef CONFIG_NUMA 469#ifdef CONFIG_NUMA
470struct page *page_cache_alloc(struct address_space *x) 470struct page *__page_cache_alloc(gfp_t gfp)
471{ 471{
472 if (cpuset_do_page_mem_spread()) { 472 if (cpuset_do_page_mem_spread()) {
473 int n = cpuset_mem_spread_node(); 473 int n = cpuset_mem_spread_node();
474 return alloc_pages_node(n, mapping_gfp_mask(x), 0); 474 return alloc_pages_node(n, gfp, 0);
475 } 475 }
476 return alloc_pages(mapping_gfp_mask(x), 0); 476 return alloc_pages(gfp, 0);
477} 477}
478EXPORT_SYMBOL(page_cache_alloc); 478EXPORT_SYMBOL(__page_cache_alloc);
479
480struct page *page_cache_alloc_cold(struct address_space *x)
481{
482 if (cpuset_do_page_mem_spread()) {
483 int n = cpuset_mem_spread_node();
484 return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0);
485 }
486 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
487}
488EXPORT_SYMBOL(page_cache_alloc_cold);
489#endif 479#endif
490 480
491static int __sleep_on_page_lock(void *word) 481static int __sleep_on_page_lock(void *word)
@@ -826,7 +816,6 @@ struct page *
826grab_cache_page_nowait(struct address_space *mapping, unsigned long index) 816grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
827{ 817{
828 struct page *page = find_get_page(mapping, index); 818 struct page *page = find_get_page(mapping, index);
829 gfp_t gfp_mask;
830 819
831 if (page) { 820 if (page) {
832 if (!TestSetPageLocked(page)) 821 if (!TestSetPageLocked(page))
@@ -834,9 +823,8 @@ grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
834 page_cache_release(page); 823 page_cache_release(page);
835 return NULL; 824 return NULL;
836 } 825 }
837 gfp_mask = mapping_gfp_mask(mapping) & ~__GFP_FS; 826 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS);
838 page = alloc_pages(gfp_mask, 0); 827 if (page && add_to_page_cache_lru(page, mapping, index, GFP_KERNEL)) {
839 if (page && add_to_page_cache_lru(page, mapping, index, gfp_mask)) {
840 page_cache_release(page); 828 page_cache_release(page);
841 page = NULL; 829 page = NULL;
842 } 830 }
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 2dbec90dc3ba..a088f593a807 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -478,6 +478,9 @@ int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
478retry: 478retry:
479 page = find_lock_page(mapping, idx); 479 page = find_lock_page(mapping, idx);
480 if (!page) { 480 if (!page) {
481 size = i_size_read(mapping->host) >> HPAGE_SHIFT;
482 if (idx >= size)
483 goto out;
481 if (hugetlb_get_quota(mapping)) 484 if (hugetlb_get_quota(mapping))
482 goto out; 485 goto out;
483 page = alloc_huge_page(vma, address); 486 page = alloc_huge_page(vma, address);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f5fc45472d5c..b55bb358b832 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2261,7 +2261,7 @@ unsigned long __init __absent_pages_in_range(int nid,
2261 2261
2262 /* Account for ranges past physical memory on this node */ 2262 /* Account for ranges past physical memory on this node */
2263 if (range_end_pfn > prev_end_pfn) 2263 if (range_end_pfn > prev_end_pfn)
2264 hole_pages = range_end_pfn - 2264 hole_pages += range_end_pfn -
2265 max(range_start_pfn, prev_end_pfn); 2265 max(range_start_pfn, prev_end_pfn);
2266 2266
2267 return hole_pages; 2267 return hole_pages;
@@ -2407,7 +2407,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
2407 zone->zone_pgdat = pgdat; 2407 zone->zone_pgdat = pgdat;
2408 zone->free_pages = 0; 2408 zone->free_pages = 0;
2409 2409
2410 zone->temp_priority = zone->prev_priority = DEF_PRIORITY; 2410 zone->prev_priority = DEF_PRIORITY;
2411 2411
2412 zone_pcp_init(zone); 2412 zone_pcp_init(zone);
2413 INIT_LIST_HEAD(&zone->active_list); 2413 INIT_LIST_HEAD(&zone->active_list);
diff --git a/mm/sparse.c b/mm/sparse.c
index 86c52ab80878..b3c82ba30012 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -211,7 +211,7 @@ static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
211 struct page *page, *ret; 211 struct page *page, *ret;
212 unsigned long memmap_size = sizeof(struct page) * nr_pages; 212 unsigned long memmap_size = sizeof(struct page) * nr_pages;
213 213
214 page = alloc_pages(GFP_KERNEL, get_order(memmap_size)); 214 page = alloc_pages(GFP_KERNEL|__GFP_NOWARN, get_order(memmap_size));
215 if (page) 215 if (page)
216 goto got_map_page; 216 goto got_map_page;
217 217
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1133dd3aafcf..46606c133e82 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -160,13 +160,15 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
160 return err; 160 return err;
161} 161}
162 162
163struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags, 163static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
164 unsigned long start, unsigned long end, int node) 164 unsigned long start, unsigned long end,
165 int node, gfp_t gfp_mask)
165{ 166{
166 struct vm_struct **p, *tmp, *area; 167 struct vm_struct **p, *tmp, *area;
167 unsigned long align = 1; 168 unsigned long align = 1;
168 unsigned long addr; 169 unsigned long addr;
169 170
171 BUG_ON(in_interrupt());
170 if (flags & VM_IOREMAP) { 172 if (flags & VM_IOREMAP) {
171 int bit = fls(size); 173 int bit = fls(size);
172 174
@@ -180,7 +182,7 @@ struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags,
180 addr = ALIGN(start, align); 182 addr = ALIGN(start, align);
181 size = PAGE_ALIGN(size); 183 size = PAGE_ALIGN(size);
182 184
183 area = kmalloc_node(sizeof(*area), GFP_KERNEL, node); 185 area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node);
184 if (unlikely(!area)) 186 if (unlikely(!area))
185 return NULL; 187 return NULL;
186 188
@@ -236,7 +238,7 @@ out:
236struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 238struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
237 unsigned long start, unsigned long end) 239 unsigned long start, unsigned long end)
238{ 240{
239 return __get_vm_area_node(size, flags, start, end, -1); 241 return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL);
240} 242}
241 243
242/** 244/**
@@ -253,9 +255,11 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags)
253 return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END); 255 return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END);
254} 256}
255 257
256struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags, int node) 258struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags,
259 int node, gfp_t gfp_mask)
257{ 260{
258 return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node); 261 return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node,
262 gfp_mask);
259} 263}
260 264
261/* Caller must hold vmlist_lock */ 265/* Caller must hold vmlist_lock */
@@ -487,7 +491,7 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
487 if (!size || (size >> PAGE_SHIFT) > num_physpages) 491 if (!size || (size >> PAGE_SHIFT) > num_physpages)
488 return NULL; 492 return NULL;
489 493
490 area = get_vm_area_node(size, VM_ALLOC, node); 494 area = get_vm_area_node(size, VM_ALLOC, node, gfp_mask);
491 if (!area) 495 if (!area)
492 return NULL; 496 return NULL;
493 497
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f05527bf792b..518540a4a2a6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -723,6 +723,20 @@ done:
723 return nr_reclaimed; 723 return nr_reclaimed;
724} 724}
725 725
726/*
727 * We are about to scan this zone at a certain priority level. If that priority
728 * level is smaller (ie: more urgent) than the previous priority, then note
729 * that priority level within the zone. This is done so that when the next
730 * process comes in to scan this zone, it will immediately start out at this
731 * priority level rather than having to build up its own scanning priority.
732 * Here, this priority affects only the reclaim-mapped threshold.
733 */
734static inline void note_zone_scanning_priority(struct zone *zone, int priority)
735{
736 if (priority < zone->prev_priority)
737 zone->prev_priority = priority;
738}
739
726static inline int zone_is_near_oom(struct zone *zone) 740static inline int zone_is_near_oom(struct zone *zone)
727{ 741{
728 return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3; 742 return zone->pages_scanned >= (zone->nr_active + zone->nr_inactive)*3;
@@ -746,7 +760,7 @@ static inline int zone_is_near_oom(struct zone *zone)
746 * But we had to alter page->flags anyway. 760 * But we had to alter page->flags anyway.
747 */ 761 */
748static void shrink_active_list(unsigned long nr_pages, struct zone *zone, 762static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
749 struct scan_control *sc) 763 struct scan_control *sc, int priority)
750{ 764{
751 unsigned long pgmoved; 765 unsigned long pgmoved;
752 int pgdeactivate = 0; 766 int pgdeactivate = 0;
@@ -770,7 +784,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
770 * `distress' is a measure of how much trouble we're having 784 * `distress' is a measure of how much trouble we're having
771 * reclaiming pages. 0 -> no problems. 100 -> great trouble. 785 * reclaiming pages. 0 -> no problems. 100 -> great trouble.
772 */ 786 */
773 distress = 100 >> zone->prev_priority; 787 distress = 100 >> min(zone->prev_priority, priority);
774 788
775 /* 789 /*
776 * The point of this algorithm is to decide when to start 790 * The point of this algorithm is to decide when to start
@@ -922,7 +936,7 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
922 nr_to_scan = min(nr_active, 936 nr_to_scan = min(nr_active,
923 (unsigned long)sc->swap_cluster_max); 937 (unsigned long)sc->swap_cluster_max);
924 nr_active -= nr_to_scan; 938 nr_active -= nr_to_scan;
925 shrink_active_list(nr_to_scan, zone, sc); 939 shrink_active_list(nr_to_scan, zone, sc, priority);
926 } 940 }
927 941
928 if (nr_inactive) { 942 if (nr_inactive) {
@@ -972,9 +986,7 @@ static unsigned long shrink_zones(int priority, struct zone **zones,
972 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 986 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
973 continue; 987 continue;
974 988
975 zone->temp_priority = priority; 989 note_zone_scanning_priority(zone, priority);
976 if (zone->prev_priority > priority)
977 zone->prev_priority = priority;
978 990
979 if (zone->all_unreclaimable && priority != DEF_PRIORITY) 991 if (zone->all_unreclaimable && priority != DEF_PRIORITY)
980 continue; /* Let kswapd poll it */ 992 continue; /* Let kswapd poll it */
@@ -1024,7 +1036,6 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1024 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 1036 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
1025 continue; 1037 continue;
1026 1038
1027 zone->temp_priority = DEF_PRIORITY;
1028 lru_pages += zone->nr_active + zone->nr_inactive; 1039 lru_pages += zone->nr_active + zone->nr_inactive;
1029 } 1040 }
1030 1041
@@ -1065,13 +1076,22 @@ unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask)
1065 if (!sc.all_unreclaimable) 1076 if (!sc.all_unreclaimable)
1066 ret = 1; 1077 ret = 1;
1067out: 1078out:
1079 /*
1080 * Now that we've scanned all the zones at this priority level, note
1081 * that level within the zone so that the next thread which performs
1082 * scanning of this zone will immediately start out at this priority
1083 * level. This affects only the decision whether or not to bring
1084 * mapped pages onto the inactive list.
1085 */
1086 if (priority < 0)
1087 priority = 0;
1068 for (i = 0; zones[i] != 0; i++) { 1088 for (i = 0; zones[i] != 0; i++) {
1069 struct zone *zone = zones[i]; 1089 struct zone *zone = zones[i];
1070 1090
1071 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) 1091 if (!cpuset_zone_allowed(zone, __GFP_HARDWALL))
1072 continue; 1092 continue;
1073 1093
1074 zone->prev_priority = zone->temp_priority; 1094 zone->prev_priority = priority;
1075 } 1095 }
1076 return ret; 1096 return ret;
1077} 1097}
@@ -1111,6 +1131,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
1111 .swap_cluster_max = SWAP_CLUSTER_MAX, 1131 .swap_cluster_max = SWAP_CLUSTER_MAX,
1112 .swappiness = vm_swappiness, 1132 .swappiness = vm_swappiness,
1113 }; 1133 };
1134 /*
1135 * temp_priority is used to remember the scanning priority at which
1136 * this zone was successfully refilled to free_pages == pages_high.
1137 */
1138 int temp_priority[MAX_NR_ZONES];
1114 1139
1115loop_again: 1140loop_again:
1116 total_scanned = 0; 1141 total_scanned = 0;
@@ -1118,11 +1143,8 @@ loop_again:
1118 sc.may_writepage = !laptop_mode; 1143 sc.may_writepage = !laptop_mode;
1119 count_vm_event(PAGEOUTRUN); 1144 count_vm_event(PAGEOUTRUN);
1120 1145
1121 for (i = 0; i < pgdat->nr_zones; i++) { 1146 for (i = 0; i < pgdat->nr_zones; i++)
1122 struct zone *zone = pgdat->node_zones + i; 1147 temp_priority[i] = DEF_PRIORITY;
1123
1124 zone->temp_priority = DEF_PRIORITY;
1125 }
1126 1148
1127 for (priority = DEF_PRIORITY; priority >= 0; priority--) { 1149 for (priority = DEF_PRIORITY; priority >= 0; priority--) {
1128 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ 1150 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
@@ -1183,10 +1205,9 @@ scan:
1183 if (!zone_watermark_ok(zone, order, zone->pages_high, 1205 if (!zone_watermark_ok(zone, order, zone->pages_high,
1184 end_zone, 0)) 1206 end_zone, 0))
1185 all_zones_ok = 0; 1207 all_zones_ok = 0;
1186 zone->temp_priority = priority; 1208 temp_priority[i] = priority;
1187 if (zone->prev_priority > priority)
1188 zone->prev_priority = priority;
1189 sc.nr_scanned = 0; 1209 sc.nr_scanned = 0;
1210 note_zone_scanning_priority(zone, priority);
1190 nr_reclaimed += shrink_zone(priority, zone, &sc); 1211 nr_reclaimed += shrink_zone(priority, zone, &sc);
1191 reclaim_state->reclaimed_slab = 0; 1212 reclaim_state->reclaimed_slab = 0;
1192 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL, 1213 nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
@@ -1226,10 +1247,15 @@ scan:
1226 break; 1247 break;
1227 } 1248 }
1228out: 1249out:
1250 /*
1251 * Note within each zone the priority level at which this zone was
1252 * brought into a happy state. So that the next thread which scans this
1253 * zone will start out at that priority level.
1254 */
1229 for (i = 0; i < pgdat->nr_zones; i++) { 1255 for (i = 0; i < pgdat->nr_zones; i++) {
1230 struct zone *zone = pgdat->node_zones + i; 1256 struct zone *zone = pgdat->node_zones + i;
1231 1257
1232 zone->prev_priority = zone->temp_priority; 1258 zone->prev_priority = temp_priority[i];
1233 } 1259 }
1234 if (!all_zones_ok) { 1260 if (!all_zones_ok) {
1235 cond_resched(); 1261 cond_resched();
@@ -1358,7 +1384,7 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int pass,
1358 if (zone->nr_scan_active >= nr_pages || pass > 3) { 1384 if (zone->nr_scan_active >= nr_pages || pass > 3) {
1359 zone->nr_scan_active = 0; 1385 zone->nr_scan_active = 0;
1360 nr_to_scan = min(nr_pages, zone->nr_active); 1386 nr_to_scan = min(nr_pages, zone->nr_active);
1361 shrink_active_list(nr_to_scan, zone, sc); 1387 shrink_active_list(nr_to_scan, zone, sc, prio);
1362 } 1388 }
1363 } 1389 }
1364 1390
@@ -1614,6 +1640,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
1614 */ 1640 */
1615 priority = ZONE_RECLAIM_PRIORITY; 1641 priority = ZONE_RECLAIM_PRIORITY;
1616 do { 1642 do {
1643 note_zone_scanning_priority(zone, priority);
1617 nr_reclaimed += shrink_zone(priority, zone, &sc); 1644 nr_reclaimed += shrink_zone(priority, zone, &sc);
1618 priority--; 1645 priority--;
1619 } while (priority >= 0 && nr_reclaimed < nr_pages); 1646 } while (priority >= 0 && nr_reclaimed < nr_pages);
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 45b124e012f5..8614e8f6743b 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -587,11 +587,9 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
587 seq_printf(m, 587 seq_printf(m,
588 "\n all_unreclaimable: %u" 588 "\n all_unreclaimable: %u"
589 "\n prev_priority: %i" 589 "\n prev_priority: %i"
590 "\n temp_priority: %i"
591 "\n start_pfn: %lu", 590 "\n start_pfn: %lu",
592 zone->all_unreclaimable, 591 zone->all_unreclaimable,
593 zone->prev_priority, 592 zone->prev_priority,
594 zone->temp_priority,
595 zone->zone_start_pfn); 593 zone->zone_start_pfn);
596 spin_unlock_irqrestore(&zone->lock, flags); 594 spin_unlock_irqrestore(&zone->lock, flags);
597 seq_putc(m, '\n'); 595 seq_putc(m, '\n');