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' (incoming from Andrew)

Merge misc fixes from Andrew Morton:
"13 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
agp: info leak in agpioc_info_wrap()
fs/affs/super.c: bugfix / double free
fanotify: fix -EOVERFLOW with large files on 64-bit
slub: use sysfs'es release mechanism for kmem_cache
revert "mm: vmscan: do not swap anon pages just because free+file is low"
autofs: fix lockref lookup
mm: filemap: update find_get_pages_tag() to deal with shadow entries
mm/compaction: make isolate_freepages start at pageblock boundary
MAINTAINERS: zswap/zbud: change maintainer email address
mm/page-writeback.c: fix divide by zero in pos_ratio_polynom
hugetlb: ensure hugepage access is denied if hugepages are not supported
slub: fix memcg_propagate_slab_attrs
drivers/rtc/rtc-pcf8523.c: fix month definition

+147 -91
+2 -2
MAINTAINERS
··· 9960 9960 F: drivers/net/hamradio/z8530.h 9961 9961 9962 9962 ZBUD COMPRESSED PAGE ALLOCATOR 9963 - M: Seth Jennings <sjenning@linux.vnet.ibm.com> 9963 + M: Seth Jennings <sjennings@variantweb.net> 9964 9964 L: linux-mm@kvack.org 9965 9965 S: Maintained 9966 9966 F: mm/zbud.c ··· 10005 10005 F: include/linux/zsmalloc.h 10006 10006 10007 10007 ZSWAP COMPRESSED SWAP CACHING 10008 - M: Seth Jennings <sjenning@linux.vnet.ibm.com> 10008 + M: Seth Jennings <sjennings@variantweb.net> 10009 10009 L: linux-mm@kvack.org 10010 10010 S: Maintained 10011 10011 F: mm/zswap.c
+1
drivers/char/agp/frontend.c
··· 730 730 731 731 agp_copy_info(agp_bridge, &kerninfo); 732 732 733 + memset(&userinfo, 0, sizeof(userinfo)); 733 734 userinfo.version.major = kerninfo.version.major; 734 735 userinfo.version.minor = kerninfo.version.minor; 735 736 userinfo.bridge_id = kerninfo.device->vendor |
+2 -2
drivers/rtc/rtc-pcf8523.c
··· 206 206 tm->tm_hour = bcd2bin(regs[2] & 0x3f); 207 207 tm->tm_mday = bcd2bin(regs[3] & 0x3f); 208 208 tm->tm_wday = regs[4] & 0x7; 209 - tm->tm_mon = bcd2bin(regs[5] & 0x1f); 209 + tm->tm_mon = bcd2bin(regs[5] & 0x1f) - 1; 210 210 tm->tm_year = bcd2bin(regs[6]) + 100; 211 211 212 212 return rtc_valid_tm(tm); ··· 229 229 regs[3] = bin2bcd(tm->tm_hour); 230 230 regs[4] = bin2bcd(tm->tm_mday); 231 231 regs[5] = tm->tm_wday; 232 - regs[6] = bin2bcd(tm->tm_mon); 232 + regs[6] = bin2bcd(tm->tm_mon + 1); 233 233 regs[7] = bin2bcd(tm->tm_year - 100); 234 234 235 235 msg.addr = client->addr;
-2
fs/affs/super.c
··· 340 340 &blocksize,&sbi->s_prefix, 341 341 sbi->s_volume, &mount_flags)) { 342 342 printk(KERN_ERR "AFFS: Error parsing options\n"); 343 - kfree(sbi->s_prefix); 344 - kfree(sbi); 345 343 return -EINVAL; 346 344 } 347 345 /* N.B. after this point s_prefix must be released */
+2 -2
fs/autofs4/root.c
··· 179 179 spin_lock(&active->d_lock); 180 180 181 181 /* Already gone? */ 182 - if (!d_count(active)) 182 + if ((int) d_count(active) <= 0) 183 183 goto next; 184 184 185 185 qstr = &active->d_name; ··· 230 230 231 231 spin_lock(&expiring->d_lock); 232 232 233 - /* Bad luck, we've already been dentry_iput */ 233 + /* We've already been dentry_iput or unlinked */ 234 234 if (!expiring->d_inode) 235 235 goto next; 236 236
+5
fs/hugetlbfs/inode.c
··· 1030 1030 int error; 1031 1031 int i; 1032 1032 1033 + if (!hugepages_supported()) { 1034 + pr_info("hugetlbfs: disabling because there are no supported hugepage sizes\n"); 1035 + return -ENOTSUPP; 1036 + } 1037 + 1033 1038 error = bdi_init(&hugetlbfs_backing_dev_info); 1034 1039 if (error) 1035 1040 return error;
+2
fs/notify/fanotify/fanotify_user.c
··· 698 698 } 699 699 group->overflow_event = &oevent->fse; 700 700 701 + if (force_o_largefile()) 702 + event_f_flags |= O_LARGEFILE; 701 703 group->fanotify_data.f_flags = event_f_flags; 702 704 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS 703 705 spin_lock_init(&group->fanotify_data.access_lock);
+10
include/linux/hugetlb.h
··· 412 412 return &mm->page_table_lock; 413 413 } 414 414 415 + static inline bool hugepages_supported(void) 416 + { 417 + /* 418 + * Some platform decide whether they support huge pages at boot 419 + * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when 420 + * there is no such support 421 + */ 422 + return HPAGE_SHIFT != 0; 423 + } 424 + 415 425 #else /* CONFIG_HUGETLB_PAGE */ 416 426 struct hstate {}; 417 427 #define alloc_huge_page_node(h, nid) NULL
+9
include/linux/slub_def.h
··· 101 101 struct kmem_cache_node *node[MAX_NUMNODES]; 102 102 }; 103 103 104 + #ifdef CONFIG_SYSFS 105 + #define SLAB_SUPPORTS_SYSFS 106 + void sysfs_slab_remove(struct kmem_cache *); 107 + #else 108 + static inline void sysfs_slab_remove(struct kmem_cache *s) 109 + { 110 + } 111 + #endif 112 + 104 113 #endif /* _LINUX_SLUB_DEF_H */
+12 -10
mm/compaction.c
··· 671 671 struct compact_control *cc) 672 672 { 673 673 struct page *page; 674 - unsigned long high_pfn, low_pfn, pfn, z_end_pfn, end_pfn; 674 + unsigned long high_pfn, low_pfn, pfn, z_end_pfn; 675 675 int nr_freepages = cc->nr_freepages; 676 676 struct list_head *freelist = &cc->freepages; 677 677 678 678 /* 679 679 * Initialise the free scanner. The starting point is where we last 680 - * scanned from (or the end of the zone if starting). The low point 681 - * is the end of the pageblock the migration scanner is using. 680 + * successfully isolated from, zone-cached value, or the end of the 681 + * zone when isolating for the first time. We need this aligned to 682 + * the pageblock boundary, because we do pfn -= pageblock_nr_pages 683 + * in the for loop. 684 + * The low boundary is the end of the pageblock the migration scanner 685 + * is using. 682 686 */ 683 - pfn = cc->free_pfn; 687 + pfn = cc->free_pfn & ~(pageblock_nr_pages-1); 684 688 low_pfn = ALIGN(cc->migrate_pfn + 1, pageblock_nr_pages); 685 689 686 690 /* ··· 704 700 for (; pfn >= low_pfn && cc->nr_migratepages > nr_freepages; 705 701 pfn -= pageblock_nr_pages) { 706 702 unsigned long isolated; 703 + unsigned long end_pfn; 707 704 708 705 /* 709 706 * This can iterate a massively long zone without finding any ··· 739 734 isolated = 0; 740 735 741 736 /* 742 - * As pfn may not start aligned, pfn+pageblock_nr_page 743 - * may cross a MAX_ORDER_NR_PAGES boundary and miss 744 - * a pfn_valid check. Ensure isolate_freepages_block() 745 - * only scans within a pageblock 737 + * Take care when isolating in last pageblock of a zone which 738 + * ends in the middle of a pageblock. 746 739 */ 747 - end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); 748 - end_pfn = min(end_pfn, z_end_pfn); 740 + end_pfn = min(pfn + pageblock_nr_pages, z_end_pfn); 749 741 isolated = isolate_freepages_block(cc, pfn, end_pfn, 750 742 freelist, false); 751 743 nr_freepages += isolated;
+28 -21
mm/filemap.c
··· 906 906 * Looks up the page cache slot at @mapping & @offset. If there is a 907 907 * page cache page, it is returned with an increased refcount. 908 908 * 909 - * If the slot holds a shadow entry of a previously evicted page, it 910 - * is returned. 909 + * If the slot holds a shadow entry of a previously evicted page, or a 910 + * swap entry from shmem/tmpfs, it is returned. 911 911 * 912 912 * Otherwise, %NULL is returned. 913 913 */ ··· 928 928 if (radix_tree_deref_retry(page)) 929 929 goto repeat; 930 930 /* 931 - * Otherwise, shmem/tmpfs must be storing a swap entry 932 - * here as an exceptional entry: so return it without 933 - * attempting to raise page count. 931 + * A shadow entry of a recently evicted page, 932 + * or a swap entry from shmem/tmpfs. Return 933 + * it without attempting to raise page count. 934 934 */ 935 935 goto out; 936 936 } ··· 983 983 * page cache page, it is returned locked and with an increased 984 984 * refcount. 985 985 * 986 - * If the slot holds a shadow entry of a previously evicted page, it 987 - * is returned. 986 + * If the slot holds a shadow entry of a previously evicted page, or a 987 + * swap entry from shmem/tmpfs, it is returned. 988 988 * 989 989 * Otherwise, %NULL is returned. 990 990 * ··· 1099 1099 * with ascending indexes. There may be holes in the indices due to 1100 1100 * not-present pages. 1101 1101 * 1102 - * Any shadow entries of evicted pages are included in the returned 1103 - * array. 1102 + * Any shadow entries of evicted pages, or swap entries from 1103 + * shmem/tmpfs, are included in the returned array. 1104 1104 * 1105 1105 * find_get_entries() returns the number of pages and shadow entries 1106 1106 * which were found. ··· 1128 1128 if (radix_tree_deref_retry(page)) 1129 1129 goto restart; 1130 1130 /* 1131 - * Otherwise, we must be storing a swap entry 1132 - * here as an exceptional entry: so return it 1133 - * without attempting to raise page count. 1131 + * A shadow entry of a recently evicted page, 1132 + * or a swap entry from shmem/tmpfs. Return 1133 + * it without attempting to raise page count. 1134 1134 */ 1135 1135 goto export; 1136 1136 } ··· 1198 1198 goto restart; 1199 1199 } 1200 1200 /* 1201 - * Otherwise, shmem/tmpfs must be storing a swap entry 1202 - * here as an exceptional entry: so skip over it - 1203 - * we only reach this from invalidate_mapping_pages(). 1201 + * A shadow entry of a recently evicted page, 1202 + * or a swap entry from shmem/tmpfs. Skip 1203 + * over it. 1204 1204 */ 1205 1205 continue; 1206 1206 } ··· 1265 1265 goto restart; 1266 1266 } 1267 1267 /* 1268 - * Otherwise, shmem/tmpfs must be storing a swap entry 1269 - * here as an exceptional entry: so stop looking for 1270 - * contiguous pages. 1268 + * A shadow entry of a recently evicted page, 1269 + * or a swap entry from shmem/tmpfs. Stop 1270 + * looking for contiguous pages. 1271 1271 */ 1272 1272 break; 1273 1273 } ··· 1341 1341 goto restart; 1342 1342 } 1343 1343 /* 1344 - * This function is never used on a shmem/tmpfs 1345 - * mapping, so a swap entry won't be found here. 1344 + * A shadow entry of a recently evicted page. 1345 + * 1346 + * Those entries should never be tagged, but 1347 + * this tree walk is lockless and the tags are 1348 + * looked up in bulk, one radix tree node at a 1349 + * time, so there is a sizable window for page 1350 + * reclaim to evict a page we saw tagged. 1351 + * 1352 + * Skip over it. 1346 1353 */ 1347 - BUG(); 1354 + continue; 1348 1355 } 1349 1356 1350 1357 if (!page_cache_get_speculative(page))
+14 -5
mm/hugetlb.c
··· 1981 1981 { 1982 1982 int i; 1983 1983 1984 - /* Some platform decide whether they support huge pages at boot 1985 - * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when 1986 - * there is no such support 1987 - */ 1988 - if (HPAGE_SHIFT == 0) 1984 + if (!hugepages_supported()) 1989 1985 return 0; 1990 1986 1991 1987 if (!size_to_hstate(default_hstate_size)) { ··· 2108 2112 unsigned long tmp; 2109 2113 int ret; 2110 2114 2115 + if (!hugepages_supported()) 2116 + return -ENOTSUPP; 2117 + 2111 2118 tmp = h->max_huge_pages; 2112 2119 2113 2120 if (write && h->order >= MAX_ORDER) ··· 2164 2165 unsigned long tmp; 2165 2166 int ret; 2166 2167 2168 + if (!hugepages_supported()) 2169 + return -ENOTSUPP; 2170 + 2167 2171 tmp = h->nr_overcommit_huge_pages; 2168 2172 2169 2173 if (write && h->order >= MAX_ORDER) ··· 2192 2190 void hugetlb_report_meminfo(struct seq_file *m) 2193 2191 { 2194 2192 struct hstate *h = &default_hstate; 2193 + if (!hugepages_supported()) 2194 + return; 2195 2195 seq_printf(m, 2196 2196 "HugePages_Total: %5lu\n" 2197 2197 "HugePages_Free: %5lu\n" ··· 2210 2206 int hugetlb_report_node_meminfo(int nid, char *buf) 2211 2207 { 2212 2208 struct hstate *h = &default_hstate; 2209 + if (!hugepages_supported()) 2210 + return 0; 2213 2211 return sprintf(buf, 2214 2212 "Node %d HugePages_Total: %5u\n" 2215 2213 "Node %d HugePages_Free: %5u\n" ··· 2225 2219 { 2226 2220 struct hstate *h; 2227 2221 int nid; 2222 + 2223 + if (!hugepages_supported()) 2224 + return; 2228 2225 2229 2226 for_each_node_state(nid, N_MEMORY) 2230 2227 for_each_hstate(h)
+12 -8
mm/memcontrol.c
··· 6686 6686 pgoff = pte_to_pgoff(ptent); 6687 6687 6688 6688 /* page is moved even if it's not RSS of this task(page-faulted). */ 6689 - page = find_get_page(mapping, pgoff); 6690 - 6691 6689 #ifdef CONFIG_SWAP 6692 6690 /* shmem/tmpfs may report page out on swap: account for that too. */ 6693 - if (radix_tree_exceptional_entry(page)) { 6694 - swp_entry_t swap = radix_to_swp_entry(page); 6695 - if (do_swap_account) 6696 - *entry = swap; 6697 - page = find_get_page(swap_address_space(swap), swap.val); 6698 - } 6691 + if (shmem_mapping(mapping)) { 6692 + page = find_get_entry(mapping, pgoff); 6693 + if (radix_tree_exceptional_entry(page)) { 6694 + swp_entry_t swp = radix_to_swp_entry(page); 6695 + if (do_swap_account) 6696 + *entry = swp; 6697 + page = find_get_page(swap_address_space(swp), swp.val); 6698 + } 6699 + } else 6700 + page = find_get_page(mapping, pgoff); 6701 + #else 6702 + page = find_get_page(mapping, pgoff); 6699 6703 #endif 6700 6704 return page; 6701 6705 }
+3 -3
mm/page-writeback.c
··· 593 593 * (5) the closer to setpoint, the smaller |df/dx| (and the reverse) 594 594 * => fast response on large errors; small oscillation near setpoint 595 595 */ 596 - static inline long long pos_ratio_polynom(unsigned long setpoint, 596 + static long long pos_ratio_polynom(unsigned long setpoint, 597 597 unsigned long dirty, 598 598 unsigned long limit) 599 599 { 600 600 long long pos_ratio; 601 601 long x; 602 602 603 - x = div_s64(((s64)setpoint - (s64)dirty) << RATELIMIT_CALC_SHIFT, 603 + x = div64_s64(((s64)setpoint - (s64)dirty) << RATELIMIT_CALC_SHIFT, 604 604 limit - setpoint + 1); 605 605 pos_ratio = x; 606 606 pos_ratio = pos_ratio * x >> RATELIMIT_CALC_SHIFT; ··· 842 842 x_intercept = bdi_setpoint + span; 843 843 844 844 if (bdi_dirty < x_intercept - span / 4) { 845 - pos_ratio = div_u64(pos_ratio * (x_intercept - bdi_dirty), 845 + pos_ratio = div64_u64(pos_ratio * (x_intercept - bdi_dirty), 846 846 x_intercept - bdi_setpoint + 1); 847 847 } else 848 848 pos_ratio /= 4;
+1
mm/slab.h
··· 91 91 #define CACHE_CREATE_MASK (SLAB_CORE_FLAGS | SLAB_DEBUG_FLAGS | SLAB_CACHE_FLAGS) 92 92 93 93 int __kmem_cache_shutdown(struct kmem_cache *); 94 + void slab_kmem_cache_release(struct kmem_cache *); 94 95 95 96 struct seq_file; 96 97 struct file;
+11 -2
mm/slab_common.c
··· 323 323 } 324 324 #endif /* CONFIG_MEMCG_KMEM */ 325 325 326 + void slab_kmem_cache_release(struct kmem_cache *s) 327 + { 328 + kfree(s->name); 329 + kmem_cache_free(kmem_cache, s); 330 + } 331 + 326 332 void kmem_cache_destroy(struct kmem_cache *s) 327 333 { 328 334 get_online_cpus(); ··· 358 352 rcu_barrier(); 359 353 360 354 memcg_free_cache_params(s); 361 - kfree(s->name); 362 - kmem_cache_free(kmem_cache, s); 355 + #ifdef SLAB_SUPPORTS_SYSFS 356 + sysfs_slab_remove(s); 357 + #else 358 + slab_kmem_cache_release(s); 359 + #endif 363 360 goto out_put_cpus; 364 361 365 362 out_unlock:
+15 -26
mm/slub.c
··· 210 210 #ifdef CONFIG_SYSFS 211 211 static int sysfs_slab_add(struct kmem_cache *); 212 212 static int sysfs_slab_alias(struct kmem_cache *, const char *); 213 - static void sysfs_slab_remove(struct kmem_cache *); 214 213 static void memcg_propagate_slab_attrs(struct kmem_cache *s); 215 214 #else 216 215 static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; } 217 216 static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) 218 217 { return 0; } 219 - static inline void sysfs_slab_remove(struct kmem_cache *s) { } 220 - 221 218 static inline void memcg_propagate_slab_attrs(struct kmem_cache *s) { } 222 219 #endif 223 220 ··· 3235 3238 3236 3239 int __kmem_cache_shutdown(struct kmem_cache *s) 3237 3240 { 3238 - int rc = kmem_cache_close(s); 3239 - 3240 - if (!rc) { 3241 - /* 3242 - * Since slab_attr_store may take the slab_mutex, we should 3243 - * release the lock while removing the sysfs entry in order to 3244 - * avoid a deadlock. Because this is pretty much the last 3245 - * operation we do and the lock will be released shortly after 3246 - * that in slab_common.c, we could just move sysfs_slab_remove 3247 - * to a later point in common code. We should do that when we 3248 - * have a common sysfs framework for all allocators. 3249 - */ 3250 - mutex_unlock(&slab_mutex); 3251 - sysfs_slab_remove(s); 3252 - mutex_lock(&slab_mutex); 3253 - } 3254 - 3255 - return rc; 3241 + return kmem_cache_close(s); 3256 3242 } 3257 3243 3258 3244 /******************************************************************** ··· 5051 5071 #ifdef CONFIG_MEMCG_KMEM 5052 5072 int i; 5053 5073 char *buffer = NULL; 5074 + struct kmem_cache *root_cache; 5054 5075 5055 - if (!is_root_cache(s)) 5076 + if (is_root_cache(s)) 5056 5077 return; 5078 + 5079 + root_cache = s->memcg_params->root_cache; 5057 5080 5058 5081 /* 5059 5082 * This mean this cache had no attribute written. Therefore, no point 5060 5083 * in copying default values around 5061 5084 */ 5062 - if (!s->max_attr_size) 5085 + if (!root_cache->max_attr_size) 5063 5086 return; 5064 5087 5065 5088 for (i = 0; i < ARRAY_SIZE(slab_attrs); i++) { ··· 5084 5101 */ 5085 5102 if (buffer) 5086 5103 buf = buffer; 5087 - else if (s->max_attr_size < ARRAY_SIZE(mbuf)) 5104 + else if (root_cache->max_attr_size < ARRAY_SIZE(mbuf)) 5088 5105 buf = mbuf; 5089 5106 else { 5090 5107 buffer = (char *) get_zeroed_page(GFP_KERNEL); ··· 5093 5110 buf = buffer; 5094 5111 } 5095 5112 5096 - attr->show(s->memcg_params->root_cache, buf); 5113 + attr->show(root_cache, buf); 5097 5114 attr->store(s, buf, strlen(buf)); 5098 5115 } 5099 5116 5100 5117 if (buffer) 5101 5118 free_page((unsigned long)buffer); 5102 5119 #endif 5120 + } 5121 + 5122 + static void kmem_cache_release(struct kobject *k) 5123 + { 5124 + slab_kmem_cache_release(to_slab(k)); 5103 5125 } 5104 5126 5105 5127 static const struct sysfs_ops slab_sysfs_ops = { ··· 5114 5126 5115 5127 static struct kobj_type slab_ktype = { 5116 5128 .sysfs_ops = &slab_sysfs_ops, 5129 + .release = kmem_cache_release, 5117 5130 }; 5118 5131 5119 5132 static int uevent_filter(struct kset *kset, struct kobject *kobj) ··· 5241 5252 goto out; 5242 5253 } 5243 5254 5244 - static void sysfs_slab_remove(struct kmem_cache *s) 5255 + void sysfs_slab_remove(struct kmem_cache *s) 5245 5256 { 5246 5257 if (slab_state < FULL) 5247 5258 /*
-8
mm/truncate.c
··· 484 484 unsigned long count = 0; 485 485 int i; 486 486 487 - /* 488 - * Note: this function may get called on a shmem/tmpfs mapping: 489 - * pagevec_lookup() might then return 0 prematurely (because it 490 - * got a gangful of swap entries); but it's hardly worth worrying 491 - * about - it can rarely have anything to free from such a mapping 492 - * (most pages are dirty), and already skips over any difficulties. 493 - */ 494 - 495 487 pagevec_init(&pvec, 0); 496 488 while (index <= end && pagevec_lookup_entries(&pvec, mapping, index, 497 489 min(end - index, (pgoff_t)PAGEVEC_SIZE - 1) + 1,
+18
mm/vmscan.c
··· 1916 1916 get_lru_size(lruvec, LRU_INACTIVE_FILE); 1917 1917 1918 1918 /* 1919 + * Prevent the reclaimer from falling into the cache trap: as 1920 + * cache pages start out inactive, every cache fault will tip 1921 + * the scan balance towards the file LRU. And as the file LRU 1922 + * shrinks, so does the window for rotation from references. 1923 + * This means we have a runaway feedback loop where a tiny 1924 + * thrashing file LRU becomes infinitely more attractive than 1925 + * anon pages. Try to detect this based on file LRU size. 1926 + */ 1927 + if (global_reclaim(sc)) { 1928 + unsigned long free = zone_page_state(zone, NR_FREE_PAGES); 1929 + 1930 + if (unlikely(file + free <= high_wmark_pages(zone))) { 1931 + scan_balance = SCAN_ANON; 1932 + goto out; 1933 + } 1934 + } 1935 + 1936 + /* 1919 1937 * There is enough inactive page cache, do not reclaim 1920 1938 * anything from the anonymous working set right now. 1921 1939 */