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

Merge misc fixes from Andrew Morton:
"7 patches.

Subsystems affected by this patch series: lib, ocfs2, and mm (slub,
migration, and memcg)"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
mm/memcg: fix NULL pointer dereference in memcg_slab_free_hook()
slub: fix unreclaimable slab stat for bulk free
mm/migrate: fix NR_ISOLATED corruption on 64-bit
mm: memcontrol: fix blocking rstat function called from atomic cgroup1 thresholding code
ocfs2: issue zeroout to EOF blocks
ocfs2: fix zero out valid data
lib/test_string.c: move string selftest in the Runtime Testing menu

+81 -57
+62 -41
fs/ocfs2/file.c
··· 1529 1529 } 1530 1530 } 1531 1531 1532 + /* 1533 + * zero out partial blocks of one cluster. 1534 + * 1535 + * start: file offset where zero starts, will be made upper block aligned. 1536 + * len: it will be trimmed to the end of current cluster if "start + len" 1537 + * is bigger than it. 1538 + */ 1539 + static int ocfs2_zeroout_partial_cluster(struct inode *inode, 1540 + u64 start, u64 len) 1541 + { 1542 + int ret; 1543 + u64 start_block, end_block, nr_blocks; 1544 + u64 p_block, offset; 1545 + u32 cluster, p_cluster, nr_clusters; 1546 + struct super_block *sb = inode->i_sb; 1547 + u64 end = ocfs2_align_bytes_to_clusters(sb, start); 1548 + 1549 + if (start + len < end) 1550 + end = start + len; 1551 + 1552 + start_block = ocfs2_blocks_for_bytes(sb, start); 1553 + end_block = ocfs2_blocks_for_bytes(sb, end); 1554 + nr_blocks = end_block - start_block; 1555 + if (!nr_blocks) 1556 + return 0; 1557 + 1558 + cluster = ocfs2_bytes_to_clusters(sb, start); 1559 + ret = ocfs2_get_clusters(inode, cluster, &p_cluster, 1560 + &nr_clusters, NULL); 1561 + if (ret) 1562 + return ret; 1563 + if (!p_cluster) 1564 + return 0; 1565 + 1566 + offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); 1567 + p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; 1568 + return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); 1569 + } 1570 + 1532 1571 static int ocfs2_zero_partial_clusters(struct inode *inode, 1533 1572 u64 start, u64 len) 1534 1573 { ··· 1577 1538 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1578 1539 unsigned int csize = osb->s_clustersize; 1579 1540 handle_t *handle; 1541 + loff_t isize = i_size_read(inode); 1580 1542 1581 1543 /* 1582 1544 * The "start" and "end" values are NOT necessarily part of ··· 1598 1558 if ((start & (csize - 1)) == 0 && (end & (csize - 1)) == 0) 1599 1559 goto out; 1600 1560 1561 + /* No page cache for EOF blocks, issue zero out to disk. */ 1562 + if (end > isize) { 1563 + /* 1564 + * zeroout eof blocks in last cluster starting from 1565 + * "isize" even "start" > "isize" because it is 1566 + * complicated to zeroout just at "start" as "start" 1567 + * may be not aligned with block size, buffer write 1568 + * would be required to do that, but out of eof buffer 1569 + * write is not supported. 1570 + */ 1571 + ret = ocfs2_zeroout_partial_cluster(inode, isize, 1572 + end - isize); 1573 + if (ret) { 1574 + mlog_errno(ret); 1575 + goto out; 1576 + } 1577 + if (start >= isize) 1578 + goto out; 1579 + end = isize; 1580 + } 1601 1581 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 1602 1582 if (IS_ERR(handle)) { 1603 1583 ret = PTR_ERR(handle); ··· 1916 1856 } 1917 1857 1918 1858 /* 1919 - * zero out partial blocks of one cluster. 1920 - * 1921 - * start: file offset where zero starts, will be made upper block aligned. 1922 - * len: it will be trimmed to the end of current cluster if "start + len" 1923 - * is bigger than it. 1924 - */ 1925 - static int ocfs2_zeroout_partial_cluster(struct inode *inode, 1926 - u64 start, u64 len) 1927 - { 1928 - int ret; 1929 - u64 start_block, end_block, nr_blocks; 1930 - u64 p_block, offset; 1931 - u32 cluster, p_cluster, nr_clusters; 1932 - struct super_block *sb = inode->i_sb; 1933 - u64 end = ocfs2_align_bytes_to_clusters(sb, start); 1934 - 1935 - if (start + len < end) 1936 - end = start + len; 1937 - 1938 - start_block = ocfs2_blocks_for_bytes(sb, start); 1939 - end_block = ocfs2_blocks_for_bytes(sb, end); 1940 - nr_blocks = end_block - start_block; 1941 - if (!nr_blocks) 1942 - return 0; 1943 - 1944 - cluster = ocfs2_bytes_to_clusters(sb, start); 1945 - ret = ocfs2_get_clusters(inode, cluster, &p_cluster, 1946 - &nr_clusters, NULL); 1947 - if (ret) 1948 - return ret; 1949 - if (!p_cluster) 1950 - return 0; 1951 - 1952 - offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); 1953 - p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; 1954 - return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); 1955 - } 1956 - 1957 - /* 1958 1859 * Parts of this function taken from xfs_change_file_space() 1959 1860 */ 1960 1861 static int __ocfs2_change_file_space(struct file *file, struct inode *inode, ··· 1956 1935 goto out_inode_unlock; 1957 1936 } 1958 1937 1959 - orig_isize = i_size_read(inode); 1960 1938 switch (sr->l_whence) { 1961 1939 case 0: /*SEEK_SET*/ 1962 1940 break; ··· 1963 1943 sr->l_start += f_pos; 1964 1944 break; 1965 1945 case 2: /*SEEK_END*/ 1966 - sr->l_start += orig_isize; 1946 + sr->l_start += i_size_read(inode); 1967 1947 break; 1968 1948 default: 1969 1949 ret = -EINVAL; ··· 2018 1998 ret = -EINVAL; 2019 1999 } 2020 2000 2001 + orig_isize = i_size_read(inode); 2021 2002 /* zeroout eof blocks in the cluster. */ 2022 2003 if (!ret && change_size && orig_isize < size) { 2023 2004 ret = ocfs2_zeroout_partial_cluster(inode, orig_isize,
-3
lib/Kconfig
··· 683 683 config OBJAGG 684 684 tristate "objagg" if COMPILE_TEST 685 685 686 - config STRING_SELFTEST 687 - tristate "Test string functions" 688 - 689 686 endmenu 690 687 691 688 config GENERIC_IOREMAP
+3
lib/Kconfig.debug
··· 2180 2180 config TEST_HEXDUMP 2181 2181 tristate "Test functions located in the hexdump module at runtime" 2182 2182 2183 + config STRING_SELFTEST 2184 + tristate "Test string functions at runtime" 2185 + 2183 2186 config TEST_STRING_HELPERS 2184 2187 tristate "Test functions located in the string_helpers module at runtime" 2185 2188
+2 -1
mm/memcontrol.c
··· 3574 3574 unsigned long val; 3575 3575 3576 3576 if (mem_cgroup_is_root(memcg)) { 3577 - cgroup_rstat_flush(memcg->css.cgroup); 3577 + /* mem_cgroup_threshold() calls here from irqsafe context */ 3578 + cgroup_rstat_flush_irqsafe(memcg->css.cgroup); 3578 3579 val = memcg_page_state(memcg, NR_FILE_PAGES) + 3579 3580 memcg_page_state(memcg, NR_ANON_MAPPED); 3580 3581 if (swap)
+1 -1
mm/migrate.c
··· 2068 2068 LIST_HEAD(migratepages); 2069 2069 new_page_t *new; 2070 2070 bool compound; 2071 - unsigned int nr_pages = thp_nr_pages(page); 2071 + int nr_pages = thp_nr_pages(page); 2072 2072 2073 2073 /* 2074 2074 * PTE mapped THP or HugeTLB page can't reach here so the page could
+1 -1
mm/slab.h
··· 346 346 continue; 347 347 348 348 page = virt_to_head_page(p[i]); 349 - objcgs = page_objcgs(page); 349 + objcgs = page_objcgs_check(page); 350 350 if (!objcgs) 351 351 continue; 352 352
+12 -10
mm/slub.c
··· 3236 3236 struct kmem_cache *s; 3237 3237 }; 3238 3238 3239 + static inline void free_nonslab_page(struct page *page) 3240 + { 3241 + unsigned int order = compound_order(page); 3242 + 3243 + VM_BUG_ON_PAGE(!PageCompound(page), page); 3244 + kfree_hook(page_address(page)); 3245 + mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, -(PAGE_SIZE << order)); 3246 + __free_pages(page, order); 3247 + } 3248 + 3239 3249 /* 3240 3250 * This function progressively scans the array with free objects (with 3241 3251 * a limited look ahead) and extract objects belonging to the same ··· 3282 3272 if (!s) { 3283 3273 /* Handle kalloc'ed objects */ 3284 3274 if (unlikely(!PageSlab(page))) { 3285 - BUG_ON(!PageCompound(page)); 3286 - kfree_hook(object); 3287 - __free_pages(page, compound_order(page)); 3275 + free_nonslab_page(page); 3288 3276 p[size] = NULL; /* mark object processed */ 3289 3277 return size; 3290 3278 } ··· 4258 4250 4259 4251 page = virt_to_head_page(x); 4260 4252 if (unlikely(!PageSlab(page))) { 4261 - unsigned int order = compound_order(page); 4262 - 4263 - BUG_ON(!PageCompound(page)); 4264 - kfree_hook(object); 4265 - mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, 4266 - -(PAGE_SIZE << order)); 4267 - __free_pages(page, order); 4253 + free_nonslab_page(page); 4268 4254 return; 4269 4255 } 4270 4256 slab_free(page->slab_cache, page, object, NULL, 1, _RET_IP_);