diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-26 21:33:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-26 21:33:33 -0500 |
commit | 2844a48706e54ddda4a04269dba4250b42f449de (patch) | |
tree | deaf92b185ed33b86c5f6de225f0d16e39a94725 | |
parent | 5687100aad982b7964f998886c282034b472653d (diff) | |
parent | aa10990e028cac3d5e255711fb9fb47e00700e35 (diff) |
Merge branch 'akpm' (Fixes from Andrew)
Merge misc fixes from Andrew Morton:
"8 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (8 patches)
futex: avoid wake_futex() for a PI futex_q
watchdog: using u64 in get_sample_period()
writeback: put unused inodes to LRU after writeback completion
mm: vmscan: check for fatal signals iff the process was throttled
Revert "mm: remove __GFP_NO_KSWAPD"
proc: check vma->vm_file before dereferencing
UAPI: strip the _UAPI prefix from header guards during header installation
include/linux/bug.h: fix sparse warning related to BUILD_BUG_ON_INVALID
-rw-r--r-- | drivers/mtd/mtdcore.c | 6 | ||||
-rw-r--r-- | fs/fs-writeback.c | 2 | ||||
-rw-r--r-- | fs/inode.c | 16 | ||||
-rw-r--r-- | fs/internal.h | 1 | ||||
-rw-r--r-- | fs/proc/base.c | 5 | ||||
-rw-r--r-- | include/linux/bug.h | 1 | ||||
-rw-r--r-- | include/linux/gfp.h | 5 | ||||
-rw-r--r-- | include/trace/events/gfpflags.h | 1 | ||||
-rw-r--r-- | kernel/futex.c | 18 | ||||
-rw-r--r-- | kernel/watchdog.c | 4 | ||||
-rw-r--r-- | mm/page_alloc.c | 7 | ||||
-rw-r--r-- | mm/vmscan.c | 37 | ||||
-rw-r--r-- | scripts/headers_install.pl | 3 |
13 files changed, 83 insertions, 23 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 374c46dff7dd..ec794a72975d 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -1077,7 +1077,8 @@ EXPORT_SYMBOL_GPL(mtd_writev); | |||
1077 | * until the request succeeds or until the allocation size falls below | 1077 | * until the request succeeds or until the allocation size falls below |
1078 | * the system page size. This attempts to make sure it does not adversely | 1078 | * the system page size. This attempts to make sure it does not adversely |
1079 | * impact system performance, so when allocating more than one page, we | 1079 | * impact system performance, so when allocating more than one page, we |
1080 | * ask the memory allocator to avoid re-trying. | 1080 | * ask the memory allocator to avoid re-trying, swapping, writing back |
1081 | * or performing I/O. | ||
1081 | * | 1082 | * |
1082 | * Note, this function also makes sure that the allocated buffer is aligned to | 1083 | * Note, this function also makes sure that the allocated buffer is aligned to |
1083 | * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value. | 1084 | * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value. |
@@ -1091,7 +1092,8 @@ EXPORT_SYMBOL_GPL(mtd_writev); | |||
1091 | */ | 1092 | */ |
1092 | void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size) | 1093 | void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size) |
1093 | { | 1094 | { |
1094 | gfp_t flags = __GFP_NOWARN | __GFP_WAIT | __GFP_NORETRY; | 1095 | gfp_t flags = __GFP_NOWARN | __GFP_WAIT | |
1096 | __GFP_NORETRY | __GFP_NO_KSWAPD; | ||
1095 | size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE); | 1097 | size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE); |
1096 | void *kbuf; | 1098 | void *kbuf; |
1097 | 1099 | ||
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 51ea267d444c..3e3422f7f0a4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -228,6 +228,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb) | |||
228 | static void inode_sync_complete(struct inode *inode) | 228 | static void inode_sync_complete(struct inode *inode) |
229 | { | 229 | { |
230 | inode->i_state &= ~I_SYNC; | 230 | inode->i_state &= ~I_SYNC; |
231 | /* If inode is clean an unused, put it into LRU now... */ | ||
232 | inode_add_lru(inode); | ||
231 | /* Waiters must see I_SYNC cleared before being woken up */ | 233 | /* Waiters must see I_SYNC cleared before being woken up */ |
232 | smp_mb(); | 234 | smp_mb(); |
233 | wake_up_bit(&inode->i_state, __I_SYNC); | 235 | wake_up_bit(&inode->i_state, __I_SYNC); |
diff --git a/fs/inode.c b/fs/inode.c index b03c71957246..64999f144153 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -408,6 +408,19 @@ static void inode_lru_list_add(struct inode *inode) | |||
408 | spin_unlock(&inode->i_sb->s_inode_lru_lock); | 408 | spin_unlock(&inode->i_sb->s_inode_lru_lock); |
409 | } | 409 | } |
410 | 410 | ||
411 | /* | ||
412 | * Add inode to LRU if needed (inode is unused and clean). | ||
413 | * | ||
414 | * Needs inode->i_lock held. | ||
415 | */ | ||
416 | void inode_add_lru(struct inode *inode) | ||
417 | { | ||
418 | if (!(inode->i_state & (I_DIRTY | I_SYNC | I_FREEING | I_WILL_FREE)) && | ||
419 | !atomic_read(&inode->i_count) && inode->i_sb->s_flags & MS_ACTIVE) | ||
420 | inode_lru_list_add(inode); | ||
421 | } | ||
422 | |||
423 | |||
411 | static void inode_lru_list_del(struct inode *inode) | 424 | static void inode_lru_list_del(struct inode *inode) |
412 | { | 425 | { |
413 | spin_lock(&inode->i_sb->s_inode_lru_lock); | 426 | spin_lock(&inode->i_sb->s_inode_lru_lock); |
@@ -1390,8 +1403,7 @@ static void iput_final(struct inode *inode) | |||
1390 | 1403 | ||
1391 | if (!drop && (sb->s_flags & MS_ACTIVE)) { | 1404 | if (!drop && (sb->s_flags & MS_ACTIVE)) { |
1392 | inode->i_state |= I_REFERENCED; | 1405 | inode->i_state |= I_REFERENCED; |
1393 | if (!(inode->i_state & (I_DIRTY|I_SYNC))) | 1406 | inode_add_lru(inode); |
1394 | inode_lru_list_add(inode); | ||
1395 | spin_unlock(&inode->i_lock); | 1407 | spin_unlock(&inode->i_lock); |
1396 | return; | 1408 | return; |
1397 | } | 1409 | } |
diff --git a/fs/internal.h b/fs/internal.h index 916b7cbf3e3e..2f6af7f645eb 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -110,6 +110,7 @@ extern int open_check_o_direct(struct file *f); | |||
110 | * inode.c | 110 | * inode.c |
111 | */ | 111 | */ |
112 | extern spinlock_t inode_sb_list_lock; | 112 | extern spinlock_t inode_sb_list_lock; |
113 | extern void inode_add_lru(struct inode *inode); | ||
113 | 114 | ||
114 | /* | 115 | /* |
115 | * fs-writeback.c | 116 | * fs-writeback.c |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3c231adf8450..9e28356a959a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1877,8 +1877,9 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
1877 | if (!vma) | 1877 | if (!vma) |
1878 | goto out_no_vma; | 1878 | goto out_no_vma; |
1879 | 1879 | ||
1880 | result = proc_map_files_instantiate(dir, dentry, task, | 1880 | if (vma->vm_file) |
1881 | (void *)(unsigned long)vma->vm_file->f_mode); | 1881 | result = proc_map_files_instantiate(dir, dentry, task, |
1882 | (void *)(unsigned long)vma->vm_file->f_mode); | ||
1882 | 1883 | ||
1883 | out_no_vma: | 1884 | out_no_vma: |
1884 | up_read(&mm->mmap_sem); | 1885 | up_read(&mm->mmap_sem); |
diff --git a/include/linux/bug.h b/include/linux/bug.h index aaac4bba6f5c..b1cf40de847e 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h | |||
@@ -15,6 +15,7 @@ struct pt_regs; | |||
15 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | 15 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) |
16 | #define BUILD_BUG_ON_ZERO(e) (0) | 16 | #define BUILD_BUG_ON_ZERO(e) (0) |
17 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | 17 | #define BUILD_BUG_ON_NULL(e) ((void*)0) |
18 | #define BUILD_BUG_ON_INVALID(e) (0) | ||
18 | #define BUILD_BUG_ON(condition) | 19 | #define BUILD_BUG_ON(condition) |
19 | #define BUILD_BUG() (0) | 20 | #define BUILD_BUG() (0) |
20 | #else /* __CHECKER__ */ | 21 | #else /* __CHECKER__ */ |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 02c1c9710be0..d0a79678f169 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -31,6 +31,7 @@ struct vm_area_struct; | |||
31 | #define ___GFP_THISNODE 0x40000u | 31 | #define ___GFP_THISNODE 0x40000u |
32 | #define ___GFP_RECLAIMABLE 0x80000u | 32 | #define ___GFP_RECLAIMABLE 0x80000u |
33 | #define ___GFP_NOTRACK 0x200000u | 33 | #define ___GFP_NOTRACK 0x200000u |
34 | #define ___GFP_NO_KSWAPD 0x400000u | ||
34 | #define ___GFP_OTHER_NODE 0x800000u | 35 | #define ___GFP_OTHER_NODE 0x800000u |
35 | #define ___GFP_WRITE 0x1000000u | 36 | #define ___GFP_WRITE 0x1000000u |
36 | 37 | ||
@@ -85,6 +86,7 @@ struct vm_area_struct; | |||
85 | #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ | 86 | #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ |
86 | #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ | 87 | #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ |
87 | 88 | ||
89 | #define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) | ||
88 | #define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ | 90 | #define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ |
89 | #define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ | 91 | #define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ |
90 | 92 | ||
@@ -114,7 +116,8 @@ struct vm_area_struct; | |||
114 | __GFP_MOVABLE) | 116 | __GFP_MOVABLE) |
115 | #define GFP_IOFS (__GFP_IO | __GFP_FS) | 117 | #define GFP_IOFS (__GFP_IO | __GFP_FS) |
116 | #define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ | 118 | #define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ |
117 | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) | 119 | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ |
120 | __GFP_NO_KSWAPD) | ||
118 | 121 | ||
119 | #ifdef CONFIG_NUMA | 122 | #ifdef CONFIG_NUMA |
120 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | 123 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) |
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h index 9391706e9254..d6fd8e5b14b7 100644 --- a/include/trace/events/gfpflags.h +++ b/include/trace/events/gfpflags.h | |||
@@ -36,6 +36,7 @@ | |||
36 | {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ | 36 | {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ |
37 | {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ | 37 | {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ |
38 | {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ | 38 | {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ |
39 | {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \ | ||
39 | {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ | 40 | {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ |
40 | ) : "GFP_NOWAIT" | 41 | ) : "GFP_NOWAIT" |
41 | 42 | ||
diff --git a/kernel/futex.c b/kernel/futex.c index 20ef219bbe9b..19eb089ca003 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -843,6 +843,9 @@ static void wake_futex(struct futex_q *q) | |||
843 | { | 843 | { |
844 | struct task_struct *p = q->task; | 844 | struct task_struct *p = q->task; |
845 | 845 | ||
846 | if (WARN(q->pi_state || q->rt_waiter, "refusing to wake PI futex\n")) | ||
847 | return; | ||
848 | |||
846 | /* | 849 | /* |
847 | * We set q->lock_ptr = NULL _before_ we wake up the task. If | 850 | * We set q->lock_ptr = NULL _before_ we wake up the task. If |
848 | * a non-futex wake up happens on another CPU then the task | 851 | * a non-futex wake up happens on another CPU then the task |
@@ -1078,6 +1081,10 @@ retry_private: | |||
1078 | 1081 | ||
1079 | plist_for_each_entry_safe(this, next, head, list) { | 1082 | plist_for_each_entry_safe(this, next, head, list) { |
1080 | if (match_futex (&this->key, &key1)) { | 1083 | if (match_futex (&this->key, &key1)) { |
1084 | if (this->pi_state || this->rt_waiter) { | ||
1085 | ret = -EINVAL; | ||
1086 | goto out_unlock; | ||
1087 | } | ||
1081 | wake_futex(this); | 1088 | wake_futex(this); |
1082 | if (++ret >= nr_wake) | 1089 | if (++ret >= nr_wake) |
1083 | break; | 1090 | break; |
@@ -1090,6 +1097,10 @@ retry_private: | |||
1090 | op_ret = 0; | 1097 | op_ret = 0; |
1091 | plist_for_each_entry_safe(this, next, head, list) { | 1098 | plist_for_each_entry_safe(this, next, head, list) { |
1092 | if (match_futex (&this->key, &key2)) { | 1099 | if (match_futex (&this->key, &key2)) { |
1100 | if (this->pi_state || this->rt_waiter) { | ||
1101 | ret = -EINVAL; | ||
1102 | goto out_unlock; | ||
1103 | } | ||
1093 | wake_futex(this); | 1104 | wake_futex(this); |
1094 | if (++op_ret >= nr_wake2) | 1105 | if (++op_ret >= nr_wake2) |
1095 | break; | 1106 | break; |
@@ -1098,6 +1109,7 @@ retry_private: | |||
1098 | ret += op_ret; | 1109 | ret += op_ret; |
1099 | } | 1110 | } |
1100 | 1111 | ||
1112 | out_unlock: | ||
1101 | double_unlock_hb(hb1, hb2); | 1113 | double_unlock_hb(hb1, hb2); |
1102 | out_put_keys: | 1114 | out_put_keys: |
1103 | put_futex_key(&key2); | 1115 | put_futex_key(&key2); |
@@ -1387,9 +1399,13 @@ retry_private: | |||
1387 | /* | 1399 | /* |
1388 | * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always | 1400 | * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always |
1389 | * be paired with each other and no other futex ops. | 1401 | * be paired with each other and no other futex ops. |
1402 | * | ||
1403 | * We should never be requeueing a futex_q with a pi_state, | ||
1404 | * which is awaiting a futex_unlock_pi(). | ||
1390 | */ | 1405 | */ |
1391 | if ((requeue_pi && !this->rt_waiter) || | 1406 | if ((requeue_pi && !this->rt_waiter) || |
1392 | (!requeue_pi && this->rt_waiter)) { | 1407 | (!requeue_pi && this->rt_waiter) || |
1408 | this->pi_state) { | ||
1393 | ret = -EINVAL; | 1409 | ret = -EINVAL; |
1394 | break; | 1410 | break; |
1395 | } | 1411 | } |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 9d4c8d5a1f53..dd4b80a9f1a9 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -116,7 +116,7 @@ static unsigned long get_timestamp(int this_cpu) | |||
116 | return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */ | 116 | return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */ |
117 | } | 117 | } |
118 | 118 | ||
119 | static unsigned long get_sample_period(void) | 119 | static u64 get_sample_period(void) |
120 | { | 120 | { |
121 | /* | 121 | /* |
122 | * convert watchdog_thresh from seconds to ns | 122 | * convert watchdog_thresh from seconds to ns |
@@ -125,7 +125,7 @@ static unsigned long get_sample_period(void) | |||
125 | * and hard thresholds) to increment before the | 125 | * and hard thresholds) to increment before the |
126 | * hardlockup detector generates a warning | 126 | * hardlockup detector generates a warning |
127 | */ | 127 | */ |
128 | return get_softlockup_thresh() * (NSEC_PER_SEC / 5); | 128 | return get_softlockup_thresh() * ((u64)NSEC_PER_SEC / 5); |
129 | } | 129 | } |
130 | 130 | ||
131 | /* Commands for resetting the watchdog */ | 131 | /* Commands for resetting the watchdog */ |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bcb72c6e2b2d..92871579cbee 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2416,8 +2416,9 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, | |||
2416 | goto nopage; | 2416 | goto nopage; |
2417 | 2417 | ||
2418 | restart: | 2418 | restart: |
2419 | wake_all_kswapd(order, zonelist, high_zoneidx, | 2419 | if (!(gfp_mask & __GFP_NO_KSWAPD)) |
2420 | zone_idx(preferred_zone)); | 2420 | wake_all_kswapd(order, zonelist, high_zoneidx, |
2421 | zone_idx(preferred_zone)); | ||
2421 | 2422 | ||
2422 | /* | 2423 | /* |
2423 | * OK, we're below the kswapd watermark and have kicked background | 2424 | * OK, we're below the kswapd watermark and have kicked background |
@@ -2494,7 +2495,7 @@ rebalance: | |||
2494 | * system then fail the allocation instead of entering direct reclaim. | 2495 | * system then fail the allocation instead of entering direct reclaim. |
2495 | */ | 2496 | */ |
2496 | if ((deferred_compaction || contended_compaction) && | 2497 | if ((deferred_compaction || contended_compaction) && |
2497 | (gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE) | 2498 | (gfp_mask & __GFP_NO_KSWAPD)) |
2498 | goto nopage; | 2499 | goto nopage; |
2499 | 2500 | ||
2500 | /* Try direct reclaim and then allocating */ | 2501 | /* Try direct reclaim and then allocating */ |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 48550c66f1f2..cbf84e152f04 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2207,9 +2207,12 @@ static bool pfmemalloc_watermark_ok(pg_data_t *pgdat) | |||
2207 | * Throttle direct reclaimers if backing storage is backed by the network | 2207 | * Throttle direct reclaimers if backing storage is backed by the network |
2208 | * and the PFMEMALLOC reserve for the preferred node is getting dangerously | 2208 | * and the PFMEMALLOC reserve for the preferred node is getting dangerously |
2209 | * depleted. kswapd will continue to make progress and wake the processes | 2209 | * depleted. kswapd will continue to make progress and wake the processes |
2210 | * when the low watermark is reached | 2210 | * when the low watermark is reached. |
2211 | * | ||
2212 | * Returns true if a fatal signal was delivered during throttling. If this | ||
2213 | * happens, the page allocator should not consider triggering the OOM killer. | ||
2211 | */ | 2214 | */ |
2212 | static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, | 2215 | static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, |
2213 | nodemask_t *nodemask) | 2216 | nodemask_t *nodemask) |
2214 | { | 2217 | { |
2215 | struct zone *zone; | 2218 | struct zone *zone; |
@@ -2224,13 +2227,20 @@ static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, | |||
2224 | * processes to block on log_wait_commit(). | 2227 | * processes to block on log_wait_commit(). |
2225 | */ | 2228 | */ |
2226 | if (current->flags & PF_KTHREAD) | 2229 | if (current->flags & PF_KTHREAD) |
2227 | return; | 2230 | goto out; |
2231 | |||
2232 | /* | ||
2233 | * If a fatal signal is pending, this process should not throttle. | ||
2234 | * It should return quickly so it can exit and free its memory | ||
2235 | */ | ||
2236 | if (fatal_signal_pending(current)) | ||
2237 | goto out; | ||
2228 | 2238 | ||
2229 | /* Check if the pfmemalloc reserves are ok */ | 2239 | /* Check if the pfmemalloc reserves are ok */ |
2230 | first_zones_zonelist(zonelist, high_zoneidx, NULL, &zone); | 2240 | first_zones_zonelist(zonelist, high_zoneidx, NULL, &zone); |
2231 | pgdat = zone->zone_pgdat; | 2241 | pgdat = zone->zone_pgdat; |
2232 | if (pfmemalloc_watermark_ok(pgdat)) | 2242 | if (pfmemalloc_watermark_ok(pgdat)) |
2233 | return; | 2243 | goto out; |
2234 | 2244 | ||
2235 | /* Account for the throttling */ | 2245 | /* Account for the throttling */ |
2236 | count_vm_event(PGSCAN_DIRECT_THROTTLE); | 2246 | count_vm_event(PGSCAN_DIRECT_THROTTLE); |
@@ -2246,12 +2256,20 @@ static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, | |||
2246 | if (!(gfp_mask & __GFP_FS)) { | 2256 | if (!(gfp_mask & __GFP_FS)) { |
2247 | wait_event_interruptible_timeout(pgdat->pfmemalloc_wait, | 2257 | wait_event_interruptible_timeout(pgdat->pfmemalloc_wait, |
2248 | pfmemalloc_watermark_ok(pgdat), HZ); | 2258 | pfmemalloc_watermark_ok(pgdat), HZ); |
2249 | return; | 2259 | |
2260 | goto check_pending; | ||
2250 | } | 2261 | } |
2251 | 2262 | ||
2252 | /* Throttle until kswapd wakes the process */ | 2263 | /* Throttle until kswapd wakes the process */ |
2253 | wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, | 2264 | wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, |
2254 | pfmemalloc_watermark_ok(pgdat)); | 2265 | pfmemalloc_watermark_ok(pgdat)); |
2266 | |||
2267 | check_pending: | ||
2268 | if (fatal_signal_pending(current)) | ||
2269 | return true; | ||
2270 | |||
2271 | out: | ||
2272 | return false; | ||
2255 | } | 2273 | } |
2256 | 2274 | ||
2257 | unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 2275 | unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
@@ -2273,13 +2291,12 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | |||
2273 | .gfp_mask = sc.gfp_mask, | 2291 | .gfp_mask = sc.gfp_mask, |
2274 | }; | 2292 | }; |
2275 | 2293 | ||
2276 | throttle_direct_reclaim(gfp_mask, zonelist, nodemask); | ||
2277 | |||
2278 | /* | 2294 | /* |
2279 | * Do not enter reclaim if fatal signal is pending. 1 is returned so | 2295 | * Do not enter reclaim if fatal signal was delivered while throttled. |
2280 | * that the page allocator does not consider triggering OOM | 2296 | * 1 is returned so that the page allocator does not OOM kill at this |
2297 | * point. | ||
2281 | */ | 2298 | */ |
2282 | if (fatal_signal_pending(current)) | 2299 | if (throttle_direct_reclaim(gfp_mask, zonelist, nodemask)) |
2283 | return 1; | 2300 | return 1; |
2284 | 2301 | ||
2285 | trace_mm_vmscan_direct_reclaim_begin(order, | 2302 | trace_mm_vmscan_direct_reclaim_begin(order, |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index 239d22d4207b..6c353ae8a451 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
@@ -42,6 +42,9 @@ foreach my $filename (@files) { | |||
42 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; | 42 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; |
43 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; | 43 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; |
44 | $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; | 44 | $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; |
45 | $line =~ s/#ifndef _UAPI/#ifndef /; | ||
46 | $line =~ s/#define _UAPI/#define /; | ||
47 | $line =~ s!#endif /[*] _UAPI!#endif /* !; | ||
45 | printf {$out} "%s", $line; | 48 | printf {$out} "%s", $line; |
46 | } | 49 | } |
47 | close $out; | 50 | close $out; |