Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+83 -23
+4 -2
drivers/mtd/mtdcore.c
··· 1077 1077 * until the request succeeds or until the allocation size falls below 1078 1078 * the system page size. This attempts to make sure it does not adversely 1079 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 1083 * Note, this function also makes sure that the allocated buffer is aligned to 1083 1084 * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value. ··· 1092 1091 */ 1093 1092 void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size) 1094 1093 { 1095 - gfp_t flags = __GFP_NOWARN | __GFP_WAIT | __GFP_NORETRY; 1094 + gfp_t flags = __GFP_NOWARN | __GFP_WAIT | 1095 + __GFP_NORETRY | __GFP_NO_KSWAPD; 1096 1096 size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE); 1097 1097 void *kbuf; 1098 1098
+2
fs/fs-writeback.c
··· 228 228 static void inode_sync_complete(struct inode *inode) 229 229 { 230 230 inode->i_state &= ~I_SYNC; 231 + /* If inode is clean an unused, put it into LRU now... */ 232 + inode_add_lru(inode); 231 233 /* Waiters must see I_SYNC cleared before being woken up */ 232 234 smp_mb(); 233 235 wake_up_bit(&inode->i_state, __I_SYNC);
+14 -2
fs/inode.c
··· 408 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 424 static void inode_lru_list_del(struct inode *inode) 412 425 { 413 426 spin_lock(&inode->i_sb->s_inode_lru_lock); ··· 1403 1390 1404 1391 if (!drop && (sb->s_flags & MS_ACTIVE)) { 1405 1392 inode->i_state |= I_REFERENCED; 1406 - if (!(inode->i_state & (I_DIRTY|I_SYNC))) 1407 - inode_lru_list_add(inode); 1393 + inode_add_lru(inode); 1408 1394 spin_unlock(&inode->i_lock); 1409 1395 return; 1410 1396 }
+1
fs/internal.h
··· 110 110 * inode.c 111 111 */ 112 112 extern spinlock_t inode_sb_list_lock; 113 + extern void inode_add_lru(struct inode *inode); 113 114 114 115 /* 115 116 * fs-writeback.c
+3 -2
fs/proc/base.c
··· 1877 1877 if (!vma) 1878 1878 goto out_no_vma; 1879 1879 1880 - result = proc_map_files_instantiate(dir, dentry, task, 1881 - (void *)(unsigned long)vma->vm_file->f_mode); 1880 + if (vma->vm_file) 1881 + result = proc_map_files_instantiate(dir, dentry, task, 1882 + (void *)(unsigned long)vma->vm_file->f_mode); 1882 1883 1883 1884 out_no_vma: 1884 1885 up_read(&mm->mmap_sem);
+1
include/linux/bug.h
··· 15 15 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) 16 16 #define BUILD_BUG_ON_ZERO(e) (0) 17 17 #define BUILD_BUG_ON_NULL(e) ((void*)0) 18 + #define BUILD_BUG_ON_INVALID(e) (0) 18 19 #define BUILD_BUG_ON(condition) 19 20 #define BUILD_BUG() (0) 20 21 #else /* __CHECKER__ */
+4 -1
include/linux/gfp.h
··· 31 31 #define ___GFP_THISNODE 0x40000u 32 32 #define ___GFP_RECLAIMABLE 0x80000u 33 33 #define ___GFP_NOTRACK 0x200000u 34 + #define ___GFP_NO_KSWAPD 0x400000u 34 35 #define ___GFP_OTHER_NODE 0x800000u 35 36 #define ___GFP_WRITE 0x1000000u 36 37 ··· 86 85 #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 87 86 #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 88 87 88 + #define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 89 89 #define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 90 90 #define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 91 91 ··· 116 114 __GFP_MOVABLE) 117 115 #define GFP_IOFS (__GFP_IO | __GFP_FS) 118 116 #define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 119 - __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) 117 + __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 118 + __GFP_NO_KSWAPD) 120 119 121 120 #ifdef CONFIG_NUMA 122 121 #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
+1
include/trace/events/gfpflags.h
··· 36 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 37 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 38 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 39 + {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \ 39 40 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ 40 41 ) : "GFP_NOWAIT" 41 42
+17 -1
kernel/futex.c
··· 843 843 { 844 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 850 * We set q->lock_ptr = NULL _before_ we wake up the task. If 848 851 * a non-futex wake up happens on another CPU then the task ··· 1081 1078 1082 1079 plist_for_each_entry_safe(this, next, head, list) { 1083 1080 if (match_futex (&this->key, &key1)) { 1081 + if (this->pi_state || this->rt_waiter) { 1082 + ret = -EINVAL; 1083 + goto out_unlock; 1084 + } 1084 1085 wake_futex(this); 1085 1086 if (++ret >= nr_wake) 1086 1087 break; ··· 1097 1090 op_ret = 0; 1098 1091 plist_for_each_entry_safe(this, next, head, list) { 1099 1092 if (match_futex (&this->key, &key2)) { 1093 + if (this->pi_state || this->rt_waiter) { 1094 + ret = -EINVAL; 1095 + goto out_unlock; 1096 + } 1100 1097 wake_futex(this); 1101 1098 if (++op_ret >= nr_wake2) 1102 1099 break; ··· 1109 1098 ret += op_ret; 1110 1099 } 1111 1100 1101 + out_unlock: 1112 1102 double_unlock_hb(hb1, hb2); 1113 1103 out_put_keys: 1114 1104 put_futex_key(&key2); ··· 1399 1387 /* 1400 1388 * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always 1401 1389 * be paired with each other and no other futex ops. 1390 + * 1391 + * We should never be requeueing a futex_q with a pi_state, 1392 + * which is awaiting a futex_unlock_pi(). 1402 1393 */ 1403 1394 if ((requeue_pi && !this->rt_waiter) || 1404 - (!requeue_pi && this->rt_waiter)) { 1395 + (!requeue_pi && this->rt_waiter) || 1396 + this->pi_state) { 1405 1397 ret = -EINVAL; 1406 1398 break; 1407 1399 }
+2 -2
kernel/watchdog.c
··· 116 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 122 * convert watchdog_thresh from seconds to ns ··· 125 125 * and hard thresholds) to increment before the 126 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 131 /* Commands for resetting the watchdog */
+4 -3
mm/page_alloc.c
··· 2416 2416 goto nopage; 2417 2417 2418 2418 restart: 2419 - wake_all_kswapd(order, zonelist, high_zoneidx, 2420 - zone_idx(preferred_zone)); 2419 + if (!(gfp_mask & __GFP_NO_KSWAPD)) 2420 + wake_all_kswapd(order, zonelist, high_zoneidx, 2421 + zone_idx(preferred_zone)); 2421 2422 2422 2423 /* 2423 2424 * OK, we're below the kswapd watermark and have kicked background ··· 2495 2494 * system then fail the allocation instead of entering direct reclaim. 2496 2495 */ 2497 2496 if ((deferred_compaction || contended_compaction) && 2498 - (gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE) 2497 + (gfp_mask & __GFP_NO_KSWAPD)) 2499 2498 goto nopage; 2500 2499 2501 2500 /* Try direct reclaim and then allocating */
+27 -10
mm/vmscan.c
··· 2207 2207 * Throttle direct reclaimers if backing storage is backed by the network 2208 2208 * and the PFMEMALLOC reserve for the preferred node is getting dangerously 2209 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 2216 nodemask_t *nodemask) 2214 2217 { 2215 2218 struct zone *zone; ··· 2227 2224 * processes to block on log_wait_commit(). 2228 2225 */ 2229 2226 if (current->flags & PF_KTHREAD) 2230 - return; 2227 + goto out; 2228 + 2229 + /* 2230 + * If a fatal signal is pending, this process should not throttle. 2231 + * It should return quickly so it can exit and free its memory 2232 + */ 2233 + if (fatal_signal_pending(current)) 2234 + goto out; 2231 2235 2232 2236 /* Check if the pfmemalloc reserves are ok */ 2233 2237 first_zones_zonelist(zonelist, high_zoneidx, NULL, &zone); 2234 2238 pgdat = zone->zone_pgdat; 2235 2239 if (pfmemalloc_watermark_ok(pgdat)) 2236 - return; 2240 + goto out; 2237 2241 2238 2242 /* Account for the throttling */ 2239 2243 count_vm_event(PGSCAN_DIRECT_THROTTLE); ··· 2256 2246 if (!(gfp_mask & __GFP_FS)) { 2257 2247 wait_event_interruptible_timeout(pgdat->pfmemalloc_wait, 2258 2248 pfmemalloc_watermark_ok(pgdat), HZ); 2259 - return; 2249 + 2250 + goto check_pending; 2260 2251 } 2261 2252 2262 2253 /* Throttle until kswapd wakes the process */ 2263 2254 wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, 2264 2255 pfmemalloc_watermark_ok(pgdat)); 2256 + 2257 + check_pending: 2258 + if (fatal_signal_pending(current)) 2259 + return true; 2260 + 2261 + out: 2262 + return false; 2265 2263 } 2266 2264 2267 2265 unsigned long try_to_free_pages(struct zonelist *zonelist, int order, ··· 2291 2273 .gfp_mask = sc.gfp_mask, 2292 2274 }; 2293 2275 2294 - throttle_direct_reclaim(gfp_mask, zonelist, nodemask); 2295 - 2296 2276 /* 2297 - * Do not enter reclaim if fatal signal is pending. 1 is returned so 2298 - * that the page allocator does not consider triggering OOM 2277 + * Do not enter reclaim if fatal signal was delivered while throttled. 2278 + * 1 is returned so that the page allocator does not OOM kill at this 2279 + * point. 2299 2280 */ 2300 - if (fatal_signal_pending(current)) 2281 + if (throttle_direct_reclaim(gfp_mask, zonelist, nodemask)) 2301 2282 return 1; 2302 2283 2303 2284 trace_mm_vmscan_direct_reclaim_begin(order,
+3
scripts/headers_install.pl
··· 42 42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g; 43 43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; 44 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 48 printf {$out} "%s", $line; 46 49 } 47 50 close $out;