diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-11 19:06:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-11 19:06:54 -0400 |
commit | 00c3e276c54ca7e102f1b771715da76b4e86a098 (patch) | |
tree | 6563a263166bb5acf1945914e3770260dcc38d65 | |
parent | 605cd83694fa175894a1c63191f1f10c449b93a8 (diff) | |
parent | 29f6738609e40227dabcc63bfb3b84b3726a75bd (diff) |
Merge branch 'akpm' (Andrew's patch-bomb)
Merge random patches from Andrew Morton.
* Merge emailed patches from Andrew Morton <akpm@linux-foundation.org>: (32 commits)
memblock: free allocated memblock_reserved_regions later
mm: sparse: fix usemap allocation above node descriptor section
mm: sparse: fix section usemap placement calculation
xtensa: fix incorrect memset
shmem: cleanup shmem_add_to_page_cache
shmem: fix negative rss in memcg memory.stat
tmpfs: revert SEEK_DATA and SEEK_HOLE
drivers/rtc/rtc-twl.c: fix threaded IRQ to use IRQF_ONESHOT
fat: fix non-atomic NFS i_pos read
MAINTAINERS: add OMAP CPUfreq driver to OMAP Power Management section
sgi-xp: nested calls to spin_lock_irqsave()
fs: ramfs: file-nommu: add SetPageUptodate()
drivers/rtc/rtc-mxc.c: fix irq enabled interrupts warning
mm/memory_hotplug.c: release memory resources if hotadd_new_pgdat() fails
h8300/uaccess: add mising __clear_user()
h8300/uaccess: remove assignment to __gu_val in unhandled case of get_user()
h8300/time: add missing #include <asm/irq_regs.h>
h8300/signal: fix typo "statis"
h8300/pgtable: add missing #include <asm-generic/pgtable.h>
drivers/rtc/rtc-ab8500.c: ensure correct probing of the AB8500 RTC when Device Tree is enabled
...
38 files changed, 197 insertions, 247 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 03df1d15ebf3..d1d9ae6173b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -4857,6 +4857,7 @@ M: Kevin Hilman <khilman@ti.com> | |||
4857 | L: linux-omap@vger.kernel.org | 4857 | L: linux-omap@vger.kernel.org |
4858 | S: Maintained | 4858 | S: Maintained |
4859 | F: arch/arm/*omap*/*pm* | 4859 | F: arch/arm/*omap*/*pm* |
4860 | F: drivers/cpufreq/omap-cpufreq.c | ||
4860 | 4861 | ||
4861 | OMAP POWERDOMAIN/CLOCKDOMAIN SOC ADAPTATION LAYER SUPPORT | 4862 | OMAP POWERDOMAIN/CLOCKDOMAIN SOC ADAPTATION LAYER SUPPORT |
4862 | M: Rajendra Nayak <rnayak@ti.com> | 4863 | M: Rajendra Nayak <rnayak@ti.com> |
diff --git a/arch/h8300/include/asm/pgtable.h b/arch/h8300/include/asm/pgtable.h index a09230a08e02..62ef17676b40 100644 --- a/arch/h8300/include/asm/pgtable.h +++ b/arch/h8300/include/asm/pgtable.h | |||
@@ -70,4 +70,7 @@ extern int is_in_rom(unsigned long); | |||
70 | #define VMALLOC_END 0xffffffff | 70 | #define VMALLOC_END 0xffffffff |
71 | 71 | ||
72 | #define arch_enter_lazy_cpu_mode() do {} while (0) | 72 | #define arch_enter_lazy_cpu_mode() do {} while (0) |
73 | |||
74 | #include <asm-generic/pgtable.h> | ||
75 | |||
73 | #endif /* _H8300_PGTABLE_H */ | 76 | #endif /* _H8300_PGTABLE_H */ |
diff --git a/arch/h8300/include/asm/uaccess.h b/arch/h8300/include/asm/uaccess.h index 356068cd0879..8725d1ad4272 100644 --- a/arch/h8300/include/asm/uaccess.h +++ b/arch/h8300/include/asm/uaccess.h | |||
@@ -100,7 +100,6 @@ extern int __put_user_bad(void); | |||
100 | break; \ | 100 | break; \ |
101 | default: \ | 101 | default: \ |
102 | __gu_err = __get_user_bad(); \ | 102 | __gu_err = __get_user_bad(); \ |
103 | __gu_val = 0; \ | ||
104 | break; \ | 103 | break; \ |
105 | } \ | 104 | } \ |
106 | (x) = __gu_val; \ | 105 | (x) = __gu_val; \ |
@@ -159,4 +158,6 @@ clear_user(void *to, unsigned long n) | |||
159 | return 0; | 158 | return 0; |
160 | } | 159 | } |
161 | 160 | ||
161 | #define __clear_user clear_user | ||
162 | |||
162 | #endif /* _H8300_UACCESS_H */ | 163 | #endif /* _H8300_UACCESS_H */ |
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c index fca10378701b..5adaadaf9218 100644 --- a/arch/h8300/kernel/signal.c +++ b/arch/h8300/kernel/signal.c | |||
@@ -447,7 +447,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
447 | * want to handle. Thus you cannot kill init even with a SIGKILL even by | 447 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
448 | * mistake. | 448 | * mistake. |
449 | */ | 449 | */ |
450 | statis void do_signal(struct pt_regs *regs) | 450 | static void do_signal(struct pt_regs *regs) |
451 | { | 451 | { |
452 | siginfo_t info; | 452 | siginfo_t info; |
453 | int signr; | 453 | int signr; |
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c index 32263a138aa6..e0f74191d553 100644 --- a/arch/h8300/kernel/time.c +++ b/arch/h8300/kernel/time.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/profile.h> | 27 | #include <linux/profile.h> |
28 | 28 | ||
29 | #include <asm/io.h> | 29 | #include <asm/io.h> |
30 | #include <asm/irq_regs.h> | ||
30 | #include <asm/timer.h> | 31 | #include <asm/timer.h> |
31 | 32 | ||
32 | #define TICK_SIZE (tick_nsec / 1000) | 33 | #define TICK_SIZE (tick_nsec / 1000) |
diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h index 55b79ef10028..44251b974f1d 100644 --- a/arch/mn10300/include/asm/ptrace.h +++ b/arch/mn10300/include/asm/ptrace.h | |||
@@ -81,9 +81,6 @@ struct pt_regs { | |||
81 | #define PTRACE_GETFPREGS 14 | 81 | #define PTRACE_GETFPREGS 14 |
82 | #define PTRACE_SETFPREGS 15 | 82 | #define PTRACE_SETFPREGS 15 |
83 | 83 | ||
84 | /* options set using PTRACE_SETOPTIONS */ | ||
85 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | ||
86 | |||
87 | #ifdef __KERNEL__ | 84 | #ifdef __KERNEL__ |
88 | 85 | ||
89 | #define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) | 86 | #define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) |
diff --git a/arch/mn10300/include/asm/timex.h b/arch/mn10300/include/asm/timex.h index bd4e90dfe6c2..f8e66425cbf8 100644 --- a/arch/mn10300/include/asm/timex.h +++ b/arch/mn10300/include/asm/timex.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #ifndef _ASM_TIMEX_H | 11 | #ifndef _ASM_TIMEX_H |
12 | #define _ASM_TIMEX_H | 12 | #define _ASM_TIMEX_H |
13 | 13 | ||
14 | #include <asm/hardirq.h> | ||
15 | #include <unit/timex.h> | 14 | #include <unit/timex.h> |
16 | 15 | ||
17 | #define TICK_SIZE (tick_nsec / 1000) | 16 | #define TICK_SIZE (tick_nsec / 1000) |
@@ -30,16 +29,6 @@ static inline cycles_t get_cycles(void) | |||
30 | extern int init_clockevents(void); | 29 | extern int init_clockevents(void); |
31 | extern int init_clocksource(void); | 30 | extern int init_clocksource(void); |
32 | 31 | ||
33 | static inline void setup_jiffies_interrupt(int irq, | ||
34 | struct irqaction *action) | ||
35 | { | ||
36 | u16 tmp; | ||
37 | setup_irq(irq, action); | ||
38 | set_intr_level(irq, NUM2GxICR_LEVEL(CONFIG_TIMER_IRQ_LEVEL)); | ||
39 | GxICR(irq) |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST; | ||
40 | tmp = GxICR(irq); | ||
41 | } | ||
42 | |||
43 | #endif /* __KERNEL__ */ | 32 | #endif /* __KERNEL__ */ |
44 | 33 | ||
45 | #endif /* _ASM_TIMEX_H */ | 34 | #endif /* _ASM_TIMEX_H */ |
diff --git a/arch/mn10300/kernel/cevt-mn10300.c b/arch/mn10300/kernel/cevt-mn10300.c index 69cae0260786..ccce35e3e179 100644 --- a/arch/mn10300/kernel/cevt-mn10300.c +++ b/arch/mn10300/kernel/cevt-mn10300.c | |||
@@ -70,6 +70,16 @@ static void event_handler(struct clock_event_device *dev) | |||
70 | { | 70 | { |
71 | } | 71 | } |
72 | 72 | ||
73 | static inline void setup_jiffies_interrupt(int irq, | ||
74 | struct irqaction *action) | ||
75 | { | ||
76 | u16 tmp; | ||
77 | setup_irq(irq, action); | ||
78 | set_intr_level(irq, NUM2GxICR_LEVEL(CONFIG_TIMER_IRQ_LEVEL)); | ||
79 | GxICR(irq) |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST; | ||
80 | tmp = GxICR(irq); | ||
81 | } | ||
82 | |||
73 | int __init init_clockevents(void) | 83 | int __init init_clockevents(void) |
74 | { | 84 | { |
75 | struct clock_event_device *cd; | 85 | struct clock_event_device *cd; |
diff --git a/arch/mn10300/kernel/internal.h b/arch/mn10300/kernel/internal.h index a5ac755dd69f..2df440105a80 100644 --- a/arch/mn10300/kernel/internal.h +++ b/arch/mn10300/kernel/internal.h | |||
@@ -9,6 +9,8 @@ | |||
9 | * 2 of the Licence, or (at your option) any later version. | 9 | * 2 of the Licence, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/irqreturn.h> | ||
13 | |||
12 | struct clocksource; | 14 | struct clocksource; |
13 | struct clock_event_device; | 15 | struct clock_event_device; |
14 | 16 | ||
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c index 2381df83bd00..35932a8de8b8 100644 --- a/arch/mn10300/kernel/irq.c +++ b/arch/mn10300/kernel/irq.c | |||
@@ -170,9 +170,9 @@ mn10300_cpupic_setaffinity(struct irq_data *d, const struct cpumask *mask, | |||
170 | case SC1TXIRQ: | 170 | case SC1TXIRQ: |
171 | #ifdef CONFIG_MN10300_TTYSM1_TIMER12 | 171 | #ifdef CONFIG_MN10300_TTYSM1_TIMER12 |
172 | case TM12IRQ: | 172 | case TM12IRQ: |
173 | #elif CONFIG_MN10300_TTYSM1_TIMER9 | 173 | #elif defined(CONFIG_MN10300_TTYSM1_TIMER9) |
174 | case TM9IRQ: | 174 | case TM9IRQ: |
175 | #elif CONFIG_MN10300_TTYSM1_TIMER3 | 175 | #elif defined(CONFIG_MN10300_TTYSM1_TIMER3) |
176 | case TM3IRQ: | 176 | case TM3IRQ: |
177 | #endif /* CONFIG_MN10300_TTYSM1_TIMER12 */ | 177 | #endif /* CONFIG_MN10300_TTYSM1_TIMER12 */ |
178 | #endif /* CONFIG_MN10300_TTYSM1 */ | 178 | #endif /* CONFIG_MN10300_TTYSM1 */ |
diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c index 94a9c6d53e1b..b900e5afa0ae 100644 --- a/arch/mn10300/kernel/traps.c +++ b/arch/mn10300/kernel/traps.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kdebug.h> | 26 | #include <linux/kdebug.h> |
27 | #include <linux/bug.h> | 27 | #include <linux/bug.h> |
28 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
29 | #include <linux/export.h> | ||
29 | #include <asm/processor.h> | 30 | #include <asm/processor.h> |
30 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c index 159acb02cfd4..e244ebe637e1 100644 --- a/arch/mn10300/mm/dma-alloc.c +++ b/arch/mn10300/mm/dma-alloc.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
17 | #include <linux/gfp.h> | 17 | #include <linux/gfp.h> |
18 | #include <linux/export.h> | ||
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
19 | 20 | ||
20 | static unsigned long pci_sram_allocated = 0xbc000000; | 21 | static unsigned long pci_sram_allocated = 0xbc000000; |
diff --git a/arch/mn10300/unit-asb2303/include/unit/timex.h b/arch/mn10300/unit-asb2303/include/unit/timex.h index cc18fe7d8b90..c37f9832cf17 100644 --- a/arch/mn10300/unit-asb2303/include/unit/timex.h +++ b/arch/mn10300/unit-asb2303/include/unit/timex.h | |||
@@ -11,10 +11,6 @@ | |||
11 | #ifndef _ASM_UNIT_TIMEX_H | 11 | #ifndef _ASM_UNIT_TIMEX_H |
12 | #define _ASM_UNIT_TIMEX_H | 12 | #define _ASM_UNIT_TIMEX_H |
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | ||
15 | #include <linux/irq.h> | ||
16 | #endif /* __ASSEMBLY__ */ | ||
17 | |||
18 | #include <asm/timer-regs.h> | 14 | #include <asm/timer-regs.h> |
19 | #include <unit/clock.h> | 15 | #include <unit/clock.h> |
20 | #include <asm/param.h> | 16 | #include <asm/param.h> |
diff --git a/arch/mn10300/unit-asb2303/smc91111.c b/arch/mn10300/unit-asb2303/smc91111.c index 43c246439413..53677694b165 100644 --- a/arch/mn10300/unit-asb2303/smc91111.c +++ b/arch/mn10300/unit-asb2303/smc91111.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | 16 | ||
17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
18 | #include <asm/irq.h> | ||
18 | #include <asm/timex.h> | 19 | #include <asm/timex.h> |
19 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
20 | #include <asm/intctl-regs.h> | 21 | #include <asm/intctl-regs.h> |
diff --git a/arch/mn10300/unit-asb2305/include/unit/timex.h b/arch/mn10300/unit-asb2305/include/unit/timex.h index 758af30d1a16..4cefc224f448 100644 --- a/arch/mn10300/unit-asb2305/include/unit/timex.h +++ b/arch/mn10300/unit-asb2305/include/unit/timex.h | |||
@@ -11,10 +11,6 @@ | |||
11 | #ifndef _ASM_UNIT_TIMEX_H | 11 | #ifndef _ASM_UNIT_TIMEX_H |
12 | #define _ASM_UNIT_TIMEX_H | 12 | #define _ASM_UNIT_TIMEX_H |
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | ||
15 | #include <linux/irq.h> | ||
16 | #endif /* __ASSEMBLY__ */ | ||
17 | |||
18 | #include <asm/timer-regs.h> | 14 | #include <asm/timer-regs.h> |
19 | #include <unit/clock.h> | 15 | #include <unit/clock.h> |
20 | #include <asm/param.h> | 16 | #include <asm/param.h> |
diff --git a/arch/mn10300/unit-asb2305/unit-init.c b/arch/mn10300/unit-asb2305/unit-init.c index e1becd6b7571..bc4adfaf815c 100644 --- a/arch/mn10300/unit-asb2305/unit-init.c +++ b/arch/mn10300/unit-asb2305/unit-init.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <asm/irq.h> | ||
16 | #include <asm/setup.h> | 17 | #include <asm/setup.h> |
17 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
18 | #include <asm/intctl-regs.h> | 19 | #include <asm/intctl-regs.h> |
diff --git a/arch/mn10300/unit-asb2364/include/unit/timex.h b/arch/mn10300/unit-asb2364/include/unit/timex.h index ddb7ed010706..42f32db75087 100644 --- a/arch/mn10300/unit-asb2364/include/unit/timex.h +++ b/arch/mn10300/unit-asb2364/include/unit/timex.h | |||
@@ -11,10 +11,6 @@ | |||
11 | #ifndef _ASM_UNIT_TIMEX_H | 11 | #ifndef _ASM_UNIT_TIMEX_H |
12 | #define _ASM_UNIT_TIMEX_H | 12 | #define _ASM_UNIT_TIMEX_H |
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | ||
15 | #include <linux/irq.h> | ||
16 | #endif /* __ASSEMBLY__ */ | ||
17 | |||
18 | #include <asm/timer-regs.h> | 14 | #include <asm/timer-regs.h> |
19 | #include <unit/clock.h> | 15 | #include <unit/clock.h> |
20 | #include <asm/param.h> | 16 | #include <asm/param.h> |
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 9b306e550e3f..2c8d6a3d250a 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c | |||
@@ -277,7 +277,7 @@ void xtensa_elf_core_copy_regs (xtensa_gregset_t *elfregs, struct pt_regs *regs) | |||
277 | 277 | ||
278 | /* Don't leak any random bits. */ | 278 | /* Don't leak any random bits. */ |
279 | 279 | ||
280 | memset(elfregs, 0, sizeof (elfregs)); | 280 | memset(elfregs, 0, sizeof(*elfregs)); |
281 | 281 | ||
282 | /* Note: PS.EXCM is not set while user task is running; its | 282 | /* Note: PS.EXCM is not set while user task is running; its |
283 | * being set in regs->ps is for exception handling convenience. | 283 | * being set in regs->ps is for exception handling convenience. |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index 17bbacb1b4b1..87b251ab6ec5 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -452,9 +452,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
452 | 452 | ||
453 | if (msg->activate_gru_mq_desc_gpa != | 453 | if (msg->activate_gru_mq_desc_gpa != |
454 | part_uv->activate_gru_mq_desc_gpa) { | 454 | part_uv->activate_gru_mq_desc_gpa) { |
455 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); | 455 | spin_lock(&part_uv->flags_lock); |
456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; | 456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; |
457 | spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags); | 457 | spin_unlock(&part_uv->flags_lock); |
458 | part_uv->activate_gru_mq_desc_gpa = | 458 | part_uv->activate_gru_mq_desc_gpa = |
459 | msg->activate_gru_mq_desc_gpa; | 459 | msg->activate_gru_mq_desc_gpa; |
460 | } | 460 | } |
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 4bcf9ca2818a..370889d0489b 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/mfd/abx500.h> | 17 | #include <linux/mfd/abx500.h> |
18 | #include <linux/mfd/abx500/ab8500.h> | 18 | #include <linux/mfd/abx500/ab8500.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/of.h> | ||
20 | 21 | ||
21 | #define AB8500_RTC_SOFF_STAT_REG 0x00 | 22 | #define AB8500_RTC_SOFF_STAT_REG 0x00 |
22 | #define AB8500_RTC_CC_CONF_REG 0x01 | 23 | #define AB8500_RTC_CC_CONF_REG 0x01 |
@@ -422,7 +423,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
422 | } | 423 | } |
423 | 424 | ||
424 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, | 425 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, |
425 | IRQF_NO_SUSPEND, "ab8500-rtc", rtc); | 426 | IRQF_NO_SUSPEND | IRQF_ONESHOT, "ab8500-rtc", rtc); |
426 | if (err < 0) { | 427 | if (err < 0) { |
427 | rtc_device_unregister(rtc); | 428 | rtc_device_unregister(rtc); |
428 | return err; | 429 | return err; |
@@ -430,7 +431,6 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
430 | 431 | ||
431 | platform_set_drvdata(pdev, rtc); | 432 | platform_set_drvdata(pdev, rtc); |
432 | 433 | ||
433 | |||
434 | err = ab8500_sysfs_rtc_register(&pdev->dev); | 434 | err = ab8500_sysfs_rtc_register(&pdev->dev); |
435 | if (err) { | 435 | if (err) { |
436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); | 436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); |
@@ -454,10 +454,16 @@ static int __devexit ab8500_rtc_remove(struct platform_device *pdev) | |||
454 | return 0; | 454 | return 0; |
455 | } | 455 | } |
456 | 456 | ||
457 | static const struct of_device_id ab8500_rtc_match[] = { | ||
458 | { .compatible = "stericsson,ab8500-rtc", }, | ||
459 | {} | ||
460 | }; | ||
461 | |||
457 | static struct platform_driver ab8500_rtc_driver = { | 462 | static struct platform_driver ab8500_rtc_driver = { |
458 | .driver = { | 463 | .driver = { |
459 | .name = "ab8500-rtc", | 464 | .name = "ab8500-rtc", |
460 | .owner = THIS_MODULE, | 465 | .owner = THIS_MODULE, |
466 | .of_match_table = ab8500_rtc_match, | ||
461 | }, | 467 | }, |
462 | .probe = ab8500_rtc_probe, | 468 | .probe = ab8500_rtc_probe, |
463 | .remove = __devexit_p(ab8500_rtc_remove), | 469 | .remove = __devexit_p(ab8500_rtc_remove), |
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 5e1d64ee5228..e3e50d69baf8 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
@@ -202,10 +202,11 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
202 | struct platform_device *pdev = dev_id; | 202 | struct platform_device *pdev = dev_id; |
203 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 203 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
204 | void __iomem *ioaddr = pdata->ioaddr; | 204 | void __iomem *ioaddr = pdata->ioaddr; |
205 | unsigned long flags; | ||
205 | u32 status; | 206 | u32 status; |
206 | u32 events = 0; | 207 | u32 events = 0; |
207 | 208 | ||
208 | spin_lock_irq(&pdata->rtc->irq_lock); | 209 | spin_lock_irqsave(&pdata->rtc->irq_lock, flags); |
209 | status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); | 210 | status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); |
210 | /* clear interrupt sources */ | 211 | /* clear interrupt sources */ |
211 | writew(status, ioaddr + RTC_RTCISR); | 212 | writew(status, ioaddr + RTC_RTCISR); |
@@ -224,7 +225,7 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
224 | events |= (RTC_PF | RTC_IRQF); | 225 | events |= (RTC_PF | RTC_IRQF); |
225 | 226 | ||
226 | rtc_update_irq(pdata->rtc, 1, events); | 227 | rtc_update_irq(pdata->rtc, 1, events); |
227 | spin_unlock_irq(&pdata->rtc->irq_lock); | 228 | spin_unlock_irqrestore(&pdata->rtc->irq_lock, flags); |
228 | 229 | ||
229 | return IRQ_HANDLED; | 230 | return IRQ_HANDLED; |
230 | } | 231 | } |
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 1f76320e545b..e2785479113c 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c | |||
@@ -458,12 +458,12 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev) | |||
458 | clk_disable(config->clk); | 458 | clk_disable(config->clk); |
459 | clk_put(config->clk); | 459 | clk_put(config->clk); |
460 | iounmap(config->ioaddr); | 460 | iounmap(config->ioaddr); |
461 | kfree(config); | ||
462 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 461 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
463 | if (res) | 462 | if (res) |
464 | release_mem_region(res->start, resource_size(res)); | 463 | release_mem_region(res->start, resource_size(res)); |
465 | platform_set_drvdata(pdev, NULL); | 464 | platform_set_drvdata(pdev, NULL); |
466 | rtc_device_unregister(config->rtc); | 465 | rtc_device_unregister(config->rtc); |
466 | kfree(config); | ||
467 | 467 | ||
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 258abeabf624..c5d06fe83bba 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -510,7 +510,7 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
510 | } | 510 | } |
511 | 511 | ||
512 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, | 512 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, |
513 | IRQF_TRIGGER_RISING, | 513 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
514 | dev_name(&rtc->dev), rtc); | 514 | dev_name(&rtc->dev), rtc); |
515 | if (ret < 0) { | 515 | if (ret < 0) { |
516 | dev_err(&pdev->dev, "IRQ is not free.\n"); | 516 | dev_err(&pdev->dev, "IRQ is not free.\n"); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index a3d81ebf6d86..0038b32cb362 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -738,22 +738,21 @@ static int | |||
738 | fat_encode_fh(struct inode *inode, __u32 *fh, int *lenp, struct inode *parent) | 738 | fat_encode_fh(struct inode *inode, __u32 *fh, int *lenp, struct inode *parent) |
739 | { | 739 | { |
740 | int len = *lenp; | 740 | int len = *lenp; |
741 | u32 ipos_h, ipos_m, ipos_l; | 741 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
742 | loff_t i_pos; | ||
742 | 743 | ||
743 | if (len < 5) { | 744 | if (len < 5) { |
744 | *lenp = 5; | 745 | *lenp = 5; |
745 | return 255; /* no room */ | 746 | return 255; /* no room */ |
746 | } | 747 | } |
747 | 748 | ||
748 | ipos_h = MSDOS_I(inode)->i_pos >> 8; | 749 | i_pos = fat_i_pos_read(sbi, inode); |
749 | ipos_m = (MSDOS_I(inode)->i_pos & 0xf0) << 24; | ||
750 | ipos_l = (MSDOS_I(inode)->i_pos & 0x0f) << 28; | ||
751 | *lenp = 5; | 750 | *lenp = 5; |
752 | fh[0] = inode->i_ino; | 751 | fh[0] = inode->i_ino; |
753 | fh[1] = inode->i_generation; | 752 | fh[1] = inode->i_generation; |
754 | fh[2] = ipos_h; | 753 | fh[2] = i_pos >> 8; |
755 | fh[3] = ipos_m | MSDOS_I(inode)->i_logstart; | 754 | fh[3] = ((i_pos & 0xf0) << 24) | MSDOS_I(inode)->i_logstart; |
756 | fh[4] = ipos_l; | 755 | fh[4] = (i_pos & 0x0f) << 28; |
757 | if (parent) | 756 | if (parent) |
758 | fh[4] |= MSDOS_I(parent)->i_logstart; | 757 | fh[4] |= MSDOS_I(parent)->i_logstart; |
759 | return 3; | 758 | return 3; |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 98513c8ed589..7602783d7f41 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, | |||
1950 | if (ret < 0) | 1950 | if (ret < 0) |
1951 | mlog_errno(ret); | 1951 | mlog_errno(ret); |
1952 | 1952 | ||
1953 | if (file->f_flags & O_SYNC) | 1953 | if (file && (file->f_flags & O_SYNC)) |
1954 | handle->h_sync = 1; | 1954 | handle->h_sync = 1; |
1955 | 1955 | ||
1956 | ocfs2_commit_trans(osb, handle); | 1956 | ocfs2_commit_trans(osb, handle); |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index fbb0b478a346..d5378d028589 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -110,6 +110,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) | |||
110 | 110 | ||
111 | /* prevent the page from being discarded on memory pressure */ | 111 | /* prevent the page from being discarded on memory pressure */ |
112 | SetPageDirty(page); | 112 | SetPageDirty(page); |
113 | SetPageUptodate(page); | ||
113 | 114 | ||
114 | unlock_page(page); | 115 | unlock_page(page); |
115 | put_page(page); | 116 | put_page(page); |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 324fe08ea3b1..6d6795d46a75 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -91,6 +91,11 @@ extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | |||
91 | unsigned long size, | 91 | unsigned long size, |
92 | unsigned long align, | 92 | unsigned long align, |
93 | unsigned long goal); | 93 | unsigned long goal); |
94 | void *___alloc_bootmem_node_nopanic(pg_data_t *pgdat, | ||
95 | unsigned long size, | ||
96 | unsigned long align, | ||
97 | unsigned long goal, | ||
98 | unsigned long limit); | ||
94 | extern void *__alloc_bootmem_low(unsigned long size, | 99 | extern void *__alloc_bootmem_low(unsigned long size, |
95 | unsigned long align, | 100 | unsigned long align, |
96 | unsigned long goal); | 101 | unsigned long goal); |
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index a6bb10235148..19dc455b4f3d 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -50,9 +50,7 @@ phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end, | |||
50 | phys_addr_t size, phys_addr_t align, int nid); | 50 | phys_addr_t size, phys_addr_t align, int nid); |
51 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, | 51 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, |
52 | phys_addr_t size, phys_addr_t align); | 52 | phys_addr_t size, phys_addr_t align); |
53 | int memblock_free_reserved_regions(void); | 53 | phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr); |
54 | int memblock_reserve_reserved_regions(void); | ||
55 | |||
56 | void memblock_allow_resize(void); | 54 | void memblock_allow_resize(void); |
57 | int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); | 55 | int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); |
58 | int memblock_add(phys_addr_t base, phys_addr_t size); | 56 | int memblock_add(phys_addr_t base, phys_addr_t size); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 2427706f78b4..68c569fcbb66 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -694,7 +694,7 @@ typedef struct pglist_data { | |||
694 | range, including holes */ | 694 | range, including holes */ |
695 | int node_id; | 695 | int node_id; |
696 | wait_queue_head_t kswapd_wait; | 696 | wait_queue_head_t kswapd_wait; |
697 | struct task_struct *kswapd; | 697 | struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ |
698 | int kswapd_max_order; | 698 | int kswapd_max_order; |
699 | enum zone_type classzone_idx; | 699 | enum zone_type classzone_idx; |
700 | } pg_data_t; | 700 | } pg_data_t; |
diff --git a/kernel/sys.c b/kernel/sys.c index e0c8ffc50d7f..2d39a84cd857 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1788,7 +1788,6 @@ SYSCALL_DEFINE1(umask, int, mask) | |||
1788 | #ifdef CONFIG_CHECKPOINT_RESTORE | 1788 | #ifdef CONFIG_CHECKPOINT_RESTORE |
1789 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | 1789 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) |
1790 | { | 1790 | { |
1791 | struct vm_area_struct *vma; | ||
1792 | struct file *exe_file; | 1791 | struct file *exe_file; |
1793 | struct dentry *dentry; | 1792 | struct dentry *dentry; |
1794 | int err; | 1793 | int err; |
@@ -1816,13 +1815,17 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
1816 | down_write(&mm->mmap_sem); | 1815 | down_write(&mm->mmap_sem); |
1817 | 1816 | ||
1818 | /* | 1817 | /* |
1819 | * Forbid mm->exe_file change if there are mapped other files. | 1818 | * Forbid mm->exe_file change if old file still mapped. |
1820 | */ | 1819 | */ |
1821 | err = -EBUSY; | 1820 | err = -EBUSY; |
1822 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 1821 | if (mm->exe_file) { |
1823 | if (vma->vm_file && !path_equal(&vma->vm_file->f_path, | 1822 | struct vm_area_struct *vma; |
1824 | &exe_file->f_path)) | 1823 | |
1825 | goto exit_unlock; | 1824 | for (vma = mm->mmap; vma; vma = vma->vm_next) |
1825 | if (vma->vm_file && | ||
1826 | path_equal(&vma->vm_file->f_path, | ||
1827 | &mm->exe_file->f_path)) | ||
1828 | goto exit_unlock; | ||
1826 | } | 1829 | } |
1827 | 1830 | ||
1828 | /* | 1831 | /* |
@@ -1835,6 +1838,7 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
1835 | if (test_and_set_bit(MMF_EXE_FILE_CHANGED, &mm->flags)) | 1838 | if (test_and_set_bit(MMF_EXE_FILE_CHANGED, &mm->flags)) |
1836 | goto exit_unlock; | 1839 | goto exit_unlock; |
1837 | 1840 | ||
1841 | err = 0; | ||
1838 | set_mm_exe_file(mm, exe_file); | 1842 | set_mm_exe_file(mm, exe_file); |
1839 | exit_unlock: | 1843 | exit_unlock: |
1840 | up_write(&mm->mmap_sem); | 1844 | up_write(&mm->mmap_sem); |
diff --git a/mm/bootmem.c b/mm/bootmem.c index ec4fcb7a56c8..73096630cb35 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -698,7 +698,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align, | |||
698 | return ___alloc_bootmem(size, align, goal, limit); | 698 | return ___alloc_bootmem(size, align, goal, limit); |
699 | } | 699 | } |
700 | 700 | ||
701 | static void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat, | 701 | void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat, |
702 | unsigned long size, unsigned long align, | 702 | unsigned long size, unsigned long align, |
703 | unsigned long goal, unsigned long limit) | 703 | unsigned long goal, unsigned long limit) |
704 | { | 704 | { |
diff --git a/mm/compaction.c b/mm/compaction.c index 7ea259d82a99..2f42d9528539 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -701,8 +701,11 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) | |||
701 | if (err) { | 701 | if (err) { |
702 | putback_lru_pages(&cc->migratepages); | 702 | putback_lru_pages(&cc->migratepages); |
703 | cc->nr_migratepages = 0; | 703 | cc->nr_migratepages = 0; |
704 | if (err == -ENOMEM) { | ||
705 | ret = COMPACT_PARTIAL; | ||
706 | goto out; | ||
707 | } | ||
704 | } | 708 | } |
705 | |||
706 | } | 709 | } |
707 | 710 | ||
708 | out: | 711 | out: |
diff --git a/mm/memblock.c b/mm/memblock.c index d4382095f8bd..5cc6731b00cc 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -143,30 +143,6 @@ phys_addr_t __init_memblock memblock_find_in_range(phys_addr_t start, | |||
143 | MAX_NUMNODES); | 143 | MAX_NUMNODES); |
144 | } | 144 | } |
145 | 145 | ||
146 | /* | ||
147 | * Free memblock.reserved.regions | ||
148 | */ | ||
149 | int __init_memblock memblock_free_reserved_regions(void) | ||
150 | { | ||
151 | if (memblock.reserved.regions == memblock_reserved_init_regions) | ||
152 | return 0; | ||
153 | |||
154 | return memblock_free(__pa(memblock.reserved.regions), | ||
155 | sizeof(struct memblock_region) * memblock.reserved.max); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * Reserve memblock.reserved.regions | ||
160 | */ | ||
161 | int __init_memblock memblock_reserve_reserved_regions(void) | ||
162 | { | ||
163 | if (memblock.reserved.regions == memblock_reserved_init_regions) | ||
164 | return 0; | ||
165 | |||
166 | return memblock_reserve(__pa(memblock.reserved.regions), | ||
167 | sizeof(struct memblock_region) * memblock.reserved.max); | ||
168 | } | ||
169 | |||
170 | static void __init_memblock memblock_remove_region(struct memblock_type *type, unsigned long r) | 146 | static void __init_memblock memblock_remove_region(struct memblock_type *type, unsigned long r) |
171 | { | 147 | { |
172 | type->total_size -= type->regions[r].size; | 148 | type->total_size -= type->regions[r].size; |
@@ -184,6 +160,18 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u | |||
184 | } | 160 | } |
185 | } | 161 | } |
186 | 162 | ||
163 | phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info( | ||
164 | phys_addr_t *addr) | ||
165 | { | ||
166 | if (memblock.reserved.regions == memblock_reserved_init_regions) | ||
167 | return 0; | ||
168 | |||
169 | *addr = __pa(memblock.reserved.regions); | ||
170 | |||
171 | return PAGE_ALIGN(sizeof(struct memblock_region) * | ||
172 | memblock.reserved.max); | ||
173 | } | ||
174 | |||
187 | /** | 175 | /** |
188 | * memblock_double_array - double the size of the memblock regions array | 176 | * memblock_double_array - double the size of the memblock regions array |
189 | * @type: memblock type of the regions array being doubled | 177 | * @type: memblock type of the regions array being doubled |
@@ -204,6 +192,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, | |||
204 | phys_addr_t new_area_size) | 192 | phys_addr_t new_area_size) |
205 | { | 193 | { |
206 | struct memblock_region *new_array, *old_array; | 194 | struct memblock_region *new_array, *old_array; |
195 | phys_addr_t old_alloc_size, new_alloc_size; | ||
207 | phys_addr_t old_size, new_size, addr; | 196 | phys_addr_t old_size, new_size, addr; |
208 | int use_slab = slab_is_available(); | 197 | int use_slab = slab_is_available(); |
209 | int *in_slab; | 198 | int *in_slab; |
@@ -217,6 +206,12 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, | |||
217 | /* Calculate new doubled size */ | 206 | /* Calculate new doubled size */ |
218 | old_size = type->max * sizeof(struct memblock_region); | 207 | old_size = type->max * sizeof(struct memblock_region); |
219 | new_size = old_size << 1; | 208 | new_size = old_size << 1; |
209 | /* | ||
210 | * We need to allocated new one align to PAGE_SIZE, | ||
211 | * so we can free them completely later. | ||
212 | */ | ||
213 | old_alloc_size = PAGE_ALIGN(old_size); | ||
214 | new_alloc_size = PAGE_ALIGN(new_size); | ||
220 | 215 | ||
221 | /* Retrieve the slab flag */ | 216 | /* Retrieve the slab flag */ |
222 | if (type == &memblock.memory) | 217 | if (type == &memblock.memory) |
@@ -245,11 +240,11 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, | |||
245 | 240 | ||
246 | addr = memblock_find_in_range(new_area_start + new_area_size, | 241 | addr = memblock_find_in_range(new_area_start + new_area_size, |
247 | memblock.current_limit, | 242 | memblock.current_limit, |
248 | new_size, sizeof(phys_addr_t)); | 243 | new_alloc_size, PAGE_SIZE); |
249 | if (!addr && new_area_size) | 244 | if (!addr && new_area_size) |
250 | addr = memblock_find_in_range(0, | 245 | addr = memblock_find_in_range(0, |
251 | min(new_area_start, memblock.current_limit), | 246 | min(new_area_start, memblock.current_limit), |
252 | new_size, sizeof(phys_addr_t)); | 247 | new_alloc_size, PAGE_SIZE); |
253 | 248 | ||
254 | new_array = addr ? __va(addr) : 0; | 249 | new_array = addr ? __va(addr) : 0; |
255 | } | 250 | } |
@@ -279,13 +274,13 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, | |||
279 | kfree(old_array); | 274 | kfree(old_array); |
280 | else if (old_array != memblock_memory_init_regions && | 275 | else if (old_array != memblock_memory_init_regions && |
281 | old_array != memblock_reserved_init_regions) | 276 | old_array != memblock_reserved_init_regions) |
282 | memblock_free(__pa(old_array), old_size); | 277 | memblock_free(__pa(old_array), old_alloc_size); |
283 | 278 | ||
284 | /* Reserve the new array if that comes from the memblock. | 279 | /* Reserve the new array if that comes from the memblock. |
285 | * Otherwise, we needn't do it | 280 | * Otherwise, we needn't do it |
286 | */ | 281 | */ |
287 | if (!use_slab) | 282 | if (!use_slab) |
288 | BUG_ON(memblock_reserve(addr, new_size)); | 283 | BUG_ON(memblock_reserve(addr, new_alloc_size)); |
289 | 284 | ||
290 | /* Update slab flag */ | 285 | /* Update slab flag */ |
291 | *in_slab = use_slab; | 286 | *in_slab = use_slab; |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 0d7e3ec8e0f3..427bb291dd0f 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -618,7 +618,7 @@ int __ref add_memory(int nid, u64 start, u64 size) | |||
618 | pgdat = hotadd_new_pgdat(nid, start); | 618 | pgdat = hotadd_new_pgdat(nid, start); |
619 | ret = -ENOMEM; | 619 | ret = -ENOMEM; |
620 | if (!pgdat) | 620 | if (!pgdat) |
621 | goto out; | 621 | goto error; |
622 | new_pgdat = 1; | 622 | new_pgdat = 1; |
623 | } | 623 | } |
624 | 624 | ||
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index d23415c001bc..405573010f99 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -105,27 +105,35 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end) | |||
105 | __free_pages_bootmem(pfn_to_page(i), 0); | 105 | __free_pages_bootmem(pfn_to_page(i), 0); |
106 | } | 106 | } |
107 | 107 | ||
108 | static unsigned long __init __free_memory_core(phys_addr_t start, | ||
109 | phys_addr_t end) | ||
110 | { | ||
111 | unsigned long start_pfn = PFN_UP(start); | ||
112 | unsigned long end_pfn = min_t(unsigned long, | ||
113 | PFN_DOWN(end), max_low_pfn); | ||
114 | |||
115 | if (start_pfn > end_pfn) | ||
116 | return 0; | ||
117 | |||
118 | __free_pages_memory(start_pfn, end_pfn); | ||
119 | |||
120 | return end_pfn - start_pfn; | ||
121 | } | ||
122 | |||
108 | unsigned long __init free_low_memory_core_early(int nodeid) | 123 | unsigned long __init free_low_memory_core_early(int nodeid) |
109 | { | 124 | { |
110 | unsigned long count = 0; | 125 | unsigned long count = 0; |
111 | phys_addr_t start, end; | 126 | phys_addr_t start, end, size; |
112 | u64 i; | 127 | u64 i; |
113 | 128 | ||
114 | /* free reserved array temporarily so that it's treated as free area */ | 129 | for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) |
115 | memblock_free_reserved_regions(); | 130 | count += __free_memory_core(start, end); |
116 | 131 | ||
117 | for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) { | 132 | /* free range that is used for reserved array if we allocate it */ |
118 | unsigned long start_pfn = PFN_UP(start); | 133 | size = get_allocated_memblock_reserved_regions_info(&start); |
119 | unsigned long end_pfn = min_t(unsigned long, | 134 | if (size) |
120 | PFN_DOWN(end), max_low_pfn); | 135 | count += __free_memory_core(start, start + size); |
121 | if (start_pfn < end_pfn) { | ||
122 | __free_pages_memory(start_pfn, end_pfn); | ||
123 | count += end_pfn - start_pfn; | ||
124 | } | ||
125 | } | ||
126 | 136 | ||
127 | /* put region array back? */ | ||
128 | memblock_reserve_reserved_regions(); | ||
129 | return count; | 137 | return count; |
130 | } | 138 | } |
131 | 139 | ||
@@ -274,7 +282,7 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align, | |||
274 | return ___alloc_bootmem(size, align, goal, limit); | 282 | return ___alloc_bootmem(size, align, goal, limit); |
275 | } | 283 | } |
276 | 284 | ||
277 | static void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat, | 285 | void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat, |
278 | unsigned long size, | 286 | unsigned long size, |
279 | unsigned long align, | 287 | unsigned long align, |
280 | unsigned long goal, | 288 | unsigned long goal, |
diff --git a/mm/shmem.c b/mm/shmem.c index 4ce02e0673db..bd106361be4b 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -264,46 +264,55 @@ static int shmem_radix_tree_replace(struct address_space *mapping, | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /* | 266 | /* |
267 | * Sometimes, before we decide whether to proceed or to fail, we must check | ||
268 | * that an entry was not already brought back from swap by a racing thread. | ||
269 | * | ||
270 | * Checking page is not enough: by the time a SwapCache page is locked, it | ||
271 | * might be reused, and again be SwapCache, using the same swap as before. | ||
272 | */ | ||
273 | static bool shmem_confirm_swap(struct address_space *mapping, | ||
274 | pgoff_t index, swp_entry_t swap) | ||
275 | { | ||
276 | void *item; | ||
277 | |||
278 | rcu_read_lock(); | ||
279 | item = radix_tree_lookup(&mapping->page_tree, index); | ||
280 | rcu_read_unlock(); | ||
281 | return item == swp_to_radix_entry(swap); | ||
282 | } | ||
283 | |||
284 | /* | ||
267 | * Like add_to_page_cache_locked, but error if expected item has gone. | 285 | * Like add_to_page_cache_locked, but error if expected item has gone. |
268 | */ | 286 | */ |
269 | static int shmem_add_to_page_cache(struct page *page, | 287 | static int shmem_add_to_page_cache(struct page *page, |
270 | struct address_space *mapping, | 288 | struct address_space *mapping, |
271 | pgoff_t index, gfp_t gfp, void *expected) | 289 | pgoff_t index, gfp_t gfp, void *expected) |
272 | { | 290 | { |
273 | int error = 0; | 291 | int error; |
274 | 292 | ||
275 | VM_BUG_ON(!PageLocked(page)); | 293 | VM_BUG_ON(!PageLocked(page)); |
276 | VM_BUG_ON(!PageSwapBacked(page)); | 294 | VM_BUG_ON(!PageSwapBacked(page)); |
277 | 295 | ||
296 | page_cache_get(page); | ||
297 | page->mapping = mapping; | ||
298 | page->index = index; | ||
299 | |||
300 | spin_lock_irq(&mapping->tree_lock); | ||
278 | if (!expected) | 301 | if (!expected) |
279 | error = radix_tree_preload(gfp & GFP_RECLAIM_MASK); | 302 | error = radix_tree_insert(&mapping->page_tree, index, page); |
303 | else | ||
304 | error = shmem_radix_tree_replace(mapping, index, expected, | ||
305 | page); | ||
280 | if (!error) { | 306 | if (!error) { |
281 | page_cache_get(page); | 307 | mapping->nrpages++; |
282 | page->mapping = mapping; | 308 | __inc_zone_page_state(page, NR_FILE_PAGES); |
283 | page->index = index; | 309 | __inc_zone_page_state(page, NR_SHMEM); |
284 | 310 | spin_unlock_irq(&mapping->tree_lock); | |
285 | spin_lock_irq(&mapping->tree_lock); | 311 | } else { |
286 | if (!expected) | 312 | page->mapping = NULL; |
287 | error = radix_tree_insert(&mapping->page_tree, | 313 | spin_unlock_irq(&mapping->tree_lock); |
288 | index, page); | 314 | page_cache_release(page); |
289 | else | ||
290 | error = shmem_radix_tree_replace(mapping, index, | ||
291 | expected, page); | ||
292 | if (!error) { | ||
293 | mapping->nrpages++; | ||
294 | __inc_zone_page_state(page, NR_FILE_PAGES); | ||
295 | __inc_zone_page_state(page, NR_SHMEM); | ||
296 | spin_unlock_irq(&mapping->tree_lock); | ||
297 | } else { | ||
298 | page->mapping = NULL; | ||
299 | spin_unlock_irq(&mapping->tree_lock); | ||
300 | page_cache_release(page); | ||
301 | } | ||
302 | if (!expected) | ||
303 | radix_tree_preload_end(); | ||
304 | } | 315 | } |
305 | if (error) | ||
306 | mem_cgroup_uncharge_cache_page(page); | ||
307 | return error; | 316 | return error; |
308 | } | 317 | } |
309 | 318 | ||
@@ -1124,9 +1133,9 @@ repeat: | |||
1124 | /* We have to do this with page locked to prevent races */ | 1133 | /* We have to do this with page locked to prevent races */ |
1125 | lock_page(page); | 1134 | lock_page(page); |
1126 | if (!PageSwapCache(page) || page_private(page) != swap.val || | 1135 | if (!PageSwapCache(page) || page_private(page) != swap.val || |
1127 | page->mapping) { | 1136 | !shmem_confirm_swap(mapping, index, swap)) { |
1128 | error = -EEXIST; /* try again */ | 1137 | error = -EEXIST; /* try again */ |
1129 | goto failed; | 1138 | goto unlock; |
1130 | } | 1139 | } |
1131 | if (!PageUptodate(page)) { | 1140 | if (!PageUptodate(page)) { |
1132 | error = -EIO; | 1141 | error = -EIO; |
@@ -1142,9 +1151,12 @@ repeat: | |||
1142 | 1151 | ||
1143 | error = mem_cgroup_cache_charge(page, current->mm, | 1152 | error = mem_cgroup_cache_charge(page, current->mm, |
1144 | gfp & GFP_RECLAIM_MASK); | 1153 | gfp & GFP_RECLAIM_MASK); |
1145 | if (!error) | 1154 | if (!error) { |
1146 | error = shmem_add_to_page_cache(page, mapping, index, | 1155 | error = shmem_add_to_page_cache(page, mapping, index, |
1147 | gfp, swp_to_radix_entry(swap)); | 1156 | gfp, swp_to_radix_entry(swap)); |
1157 | /* We already confirmed swap, and make no allocation */ | ||
1158 | VM_BUG_ON(error); | ||
1159 | } | ||
1148 | if (error) | 1160 | if (error) |
1149 | goto failed; | 1161 | goto failed; |
1150 | 1162 | ||
@@ -1181,11 +1193,18 @@ repeat: | |||
1181 | __set_page_locked(page); | 1193 | __set_page_locked(page); |
1182 | error = mem_cgroup_cache_charge(page, current->mm, | 1194 | error = mem_cgroup_cache_charge(page, current->mm, |
1183 | gfp & GFP_RECLAIM_MASK); | 1195 | gfp & GFP_RECLAIM_MASK); |
1184 | if (!error) | ||
1185 | error = shmem_add_to_page_cache(page, mapping, index, | ||
1186 | gfp, NULL); | ||
1187 | if (error) | 1196 | if (error) |
1188 | goto decused; | 1197 | goto decused; |
1198 | error = radix_tree_preload(gfp & GFP_RECLAIM_MASK); | ||
1199 | if (!error) { | ||
1200 | error = shmem_add_to_page_cache(page, mapping, index, | ||
1201 | gfp, NULL); | ||
1202 | radix_tree_preload_end(); | ||
1203 | } | ||
1204 | if (error) { | ||
1205 | mem_cgroup_uncharge_cache_page(page); | ||
1206 | goto decused; | ||
1207 | } | ||
1189 | lru_cache_add_anon(page); | 1208 | lru_cache_add_anon(page); |
1190 | 1209 | ||
1191 | spin_lock(&info->lock); | 1210 | spin_lock(&info->lock); |
@@ -1245,14 +1264,10 @@ decused: | |||
1245 | unacct: | 1264 | unacct: |
1246 | shmem_unacct_blocks(info->flags, 1); | 1265 | shmem_unacct_blocks(info->flags, 1); |
1247 | failed: | 1266 | failed: |
1248 | if (swap.val && error != -EINVAL) { | 1267 | if (swap.val && error != -EINVAL && |
1249 | struct page *test = find_get_page(mapping, index); | 1268 | !shmem_confirm_swap(mapping, index, swap)) |
1250 | if (test && !radix_tree_exceptional_entry(test)) | 1269 | error = -EEXIST; |
1251 | page_cache_release(test); | 1270 | unlock: |
1252 | /* Have another try if the entry has changed */ | ||
1253 | if (test != swp_to_radix_entry(swap)) | ||
1254 | error = -EEXIST; | ||
1255 | } | ||
1256 | if (page) { | 1271 | if (page) { |
1257 | unlock_page(page); | 1272 | unlock_page(page); |
1258 | page_cache_release(page); | 1273 | page_cache_release(page); |
@@ -1264,7 +1279,7 @@ failed: | |||
1264 | spin_unlock(&info->lock); | 1279 | spin_unlock(&info->lock); |
1265 | goto repeat; | 1280 | goto repeat; |
1266 | } | 1281 | } |
1267 | if (error == -EEXIST) | 1282 | if (error == -EEXIST) /* from above or from radix_tree_insert */ |
1268 | goto repeat; | 1283 | goto repeat; |
1269 | return error; | 1284 | return error; |
1270 | } | 1285 | } |
@@ -1692,98 +1707,6 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos, | |||
1692 | return error; | 1707 | return error; |
1693 | } | 1708 | } |
1694 | 1709 | ||
1695 | /* | ||
1696 | * llseek SEEK_DATA or SEEK_HOLE through the radix_tree. | ||
1697 | */ | ||
1698 | static pgoff_t shmem_seek_hole_data(struct address_space *mapping, | ||
1699 | pgoff_t index, pgoff_t end, int origin) | ||
1700 | { | ||
1701 | struct page *page; | ||
1702 | struct pagevec pvec; | ||
1703 | pgoff_t indices[PAGEVEC_SIZE]; | ||
1704 | bool done = false; | ||
1705 | int i; | ||
1706 | |||
1707 | pagevec_init(&pvec, 0); | ||
1708 | pvec.nr = 1; /* start small: we may be there already */ | ||
1709 | while (!done) { | ||
1710 | pvec.nr = shmem_find_get_pages_and_swap(mapping, index, | ||
1711 | pvec.nr, pvec.pages, indices); | ||
1712 | if (!pvec.nr) { | ||
1713 | if (origin == SEEK_DATA) | ||
1714 | index = end; | ||
1715 | break; | ||
1716 | } | ||
1717 | for (i = 0; i < pvec.nr; i++, index++) { | ||
1718 | if (index < indices[i]) { | ||
1719 | if (origin == SEEK_HOLE) { | ||
1720 | done = true; | ||
1721 | break; | ||
1722 | } | ||
1723 | index = indices[i]; | ||
1724 | } | ||
1725 | page = pvec.pages[i]; | ||
1726 | if (page && !radix_tree_exceptional_entry(page)) { | ||
1727 | if (!PageUptodate(page)) | ||
1728 | page = NULL; | ||
1729 | } | ||
1730 | if (index >= end || | ||
1731 | (page && origin == SEEK_DATA) || | ||
1732 | (!page && origin == SEEK_HOLE)) { | ||
1733 | done = true; | ||
1734 | break; | ||
1735 | } | ||
1736 | } | ||
1737 | shmem_deswap_pagevec(&pvec); | ||
1738 | pagevec_release(&pvec); | ||
1739 | pvec.nr = PAGEVEC_SIZE; | ||
1740 | cond_resched(); | ||
1741 | } | ||
1742 | return index; | ||
1743 | } | ||
1744 | |||
1745 | static loff_t shmem_file_llseek(struct file *file, loff_t offset, int origin) | ||
1746 | { | ||
1747 | struct address_space *mapping; | ||
1748 | struct inode *inode; | ||
1749 | pgoff_t start, end; | ||
1750 | loff_t new_offset; | ||
1751 | |||
1752 | if (origin != SEEK_DATA && origin != SEEK_HOLE) | ||
1753 | return generic_file_llseek_size(file, offset, origin, | ||
1754 | MAX_LFS_FILESIZE); | ||
1755 | mapping = file->f_mapping; | ||
1756 | inode = mapping->host; | ||
1757 | mutex_lock(&inode->i_mutex); | ||
1758 | /* We're holding i_mutex so we can access i_size directly */ | ||
1759 | |||
1760 | if (offset < 0) | ||
1761 | offset = -EINVAL; | ||
1762 | else if (offset >= inode->i_size) | ||
1763 | offset = -ENXIO; | ||
1764 | else { | ||
1765 | start = offset >> PAGE_CACHE_SHIFT; | ||
1766 | end = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
1767 | new_offset = shmem_seek_hole_data(mapping, start, end, origin); | ||
1768 | new_offset <<= PAGE_CACHE_SHIFT; | ||
1769 | if (new_offset > offset) { | ||
1770 | if (new_offset < inode->i_size) | ||
1771 | offset = new_offset; | ||
1772 | else if (origin == SEEK_DATA) | ||
1773 | offset = -ENXIO; | ||
1774 | else | ||
1775 | offset = inode->i_size; | ||
1776 | } | ||
1777 | } | ||
1778 | |||
1779 | if (offset >= 0 && offset != file->f_pos) { | ||
1780 | file->f_pos = offset; | ||
1781 | file->f_version = 0; | ||
1782 | } | ||
1783 | mutex_unlock(&inode->i_mutex); | ||
1784 | return offset; | ||
1785 | } | ||
1786 | |||
1787 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, | 1710 | static long shmem_fallocate(struct file *file, int mode, loff_t offset, |
1788 | loff_t len) | 1711 | loff_t len) |
1789 | { | 1712 | { |
@@ -2787,7 +2710,7 @@ static const struct address_space_operations shmem_aops = { | |||
2787 | static const struct file_operations shmem_file_operations = { | 2710 | static const struct file_operations shmem_file_operations = { |
2788 | .mmap = shmem_mmap, | 2711 | .mmap = shmem_mmap, |
2789 | #ifdef CONFIG_TMPFS | 2712 | #ifdef CONFIG_TMPFS |
2790 | .llseek = shmem_file_llseek, | 2713 | .llseek = generic_file_llseek, |
2791 | .read = do_sync_read, | 2714 | .read = do_sync_read, |
2792 | .write = do_sync_write, | 2715 | .write = do_sync_write, |
2793 | .aio_read = shmem_file_aio_read, | 2716 | .aio_read = shmem_file_aio_read, |
diff --git a/mm/sparse.c b/mm/sparse.c index 6a4bf9160e85..c7bb952400c8 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -275,8 +275,9 @@ static unsigned long * __init | |||
275 | sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat, | 275 | sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat, |
276 | unsigned long size) | 276 | unsigned long size) |
277 | { | 277 | { |
278 | pg_data_t *host_pgdat; | 278 | unsigned long goal, limit; |
279 | unsigned long goal; | 279 | unsigned long *p; |
280 | int nid; | ||
280 | /* | 281 | /* |
281 | * A page may contain usemaps for other sections preventing the | 282 | * A page may contain usemaps for other sections preventing the |
282 | * page being freed and making a section unremovable while | 283 | * page being freed and making a section unremovable while |
@@ -287,10 +288,17 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat, | |||
287 | * from the same section as the pgdat where possible to avoid | 288 | * from the same section as the pgdat where possible to avoid |
288 | * this problem. | 289 | * this problem. |
289 | */ | 290 | */ |
290 | goal = __pa(pgdat) & PAGE_SECTION_MASK; | 291 | goal = __pa(pgdat) & (PAGE_SECTION_MASK << PAGE_SHIFT); |
291 | host_pgdat = NODE_DATA(early_pfn_to_nid(goal >> PAGE_SHIFT)); | 292 | limit = goal + (1UL << PA_SECTION_SHIFT); |
292 | return __alloc_bootmem_node_nopanic(host_pgdat, size, | 293 | nid = early_pfn_to_nid(goal >> PAGE_SHIFT); |
293 | SMP_CACHE_BYTES, goal); | 294 | again: |
295 | p = ___alloc_bootmem_node_nopanic(NODE_DATA(nid), size, | ||
296 | SMP_CACHE_BYTES, goal, limit); | ||
297 | if (!p && limit) { | ||
298 | limit = 0; | ||
299 | goto again; | ||
300 | } | ||
301 | return p; | ||
294 | } | 302 | } |
295 | 303 | ||
296 | static void __init check_usemap_section_nr(int nid, unsigned long *usemap) | 304 | static void __init check_usemap_section_nr(int nid, unsigned long *usemap) |
diff --git a/mm/vmscan.c b/mm/vmscan.c index eeb3bc9d1d36..661576324c7f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2955,14 +2955,17 @@ int kswapd_run(int nid) | |||
2955 | } | 2955 | } |
2956 | 2956 | ||
2957 | /* | 2957 | /* |
2958 | * Called by memory hotplug when all memory in a node is offlined. | 2958 | * Called by memory hotplug when all memory in a node is offlined. Caller must |
2959 | * hold lock_memory_hotplug(). | ||
2959 | */ | 2960 | */ |
2960 | void kswapd_stop(int nid) | 2961 | void kswapd_stop(int nid) |
2961 | { | 2962 | { |
2962 | struct task_struct *kswapd = NODE_DATA(nid)->kswapd; | 2963 | struct task_struct *kswapd = NODE_DATA(nid)->kswapd; |
2963 | 2964 | ||
2964 | if (kswapd) | 2965 | if (kswapd) { |
2965 | kthread_stop(kswapd); | 2966 | kthread_stop(kswapd); |
2967 | NODE_DATA(nid)->kswapd = NULL; | ||
2968 | } | ||
2966 | } | 2969 | } |
2967 | 2970 | ||
2968 | static int __init kswapd_init(void) | 2971 | static int __init kswapd_init(void) |