Hi Alex, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on ext4/dev] [also build test WARNING on v5.7-rc6 next-20200522] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Alex-Zhuravlev/ext4-mballoc-prefetching-for-bitmaps/20200515-181552 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev config: x86_64-lkp (attached as .config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>, old ones prefixed by <<): In file included from include/linux/export.h:43:0, from include/linux/linkage.h:7, from include/linux/fs.h:5, from fs/ext4/ext4_jbd2.h:15, from fs/ext4/mballoc.c:12: fs/ext4/mballoc.c: In function 'ext4_mb_prefetch': >> fs/ext4/mballoc.c:2137:12: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] BUG_ON(nr < 0); ^ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ fs/ext4/mballoc.c:2137:2: note: in expansion of macro 'BUG_ON' BUG_ON(nr < 0); ^~~~~~ vim +2137 fs/ext4/mballoc.c 2106 2107 /* 2108 * each allocation context (i.e. a thread doing allocation) has own 2109 * sliding prefetch window of @s_mb_prefetch size which starts at the 2110 * very first goal and moves ahead of scaning. 2111 * a side effect is that subsequent allocations will likely find 2112 * the bitmaps in cache or at least in-flight. 2113 */ 2114 static void 2115 ext4_mb_prefetch(struct ext4_allocation_context *ac, 2116 ext4_group_t start) 2117 { 2118 struct super_block *sb = ac->ac_sb; 2119 ext4_group_t ngroups = ext4_get_groups_count(sb); 2120 struct ext4_sb_info *sbi = EXT4_SB(sb); 2121 struct ext4_group_info *grp; 2122 ext4_group_t nr, group = start; 2123 struct buffer_head *bh; 2124 2125 /* limit prefetching at cr=0, otherwise mballoc can 2126 * spend a lot of time loading imperfect groups */ 2127 if (ac->ac_criteria < 2 && ac->ac_prefetch_ios >= sbi->s_mb_prefetch_limit) 2128 return; 2129 2130 /* batch prefetching to get few READs in flight */ 2131 nr = ac->ac_prefetch - group; 2132 if (ac->ac_prefetch < group) 2133 /* wrapped to the first groups */ 2134 nr += ngroups; 2135 if (nr > 0) 2136 return; > 2137 BUG_ON(nr < 0); 2138 2139 nr = sbi->s_mb_prefetch; 2140 if (ext4_has_feature_flex_bg(sb)) { 2141 /* align to flex_bg to get more bitmas with a single IO */ 2142 nr = (group / sbi->s_mb_prefetch) * sbi->s_mb_prefetch; 2143 nr = nr + sbi->s_mb_prefetch - group; 2144 } 2145 while (nr-- > 0) { 2146 grp = ext4_get_group_info(sb, group); 2147 2148 /* prevent expensive getblk() on groups w/ IO in progress */ 2149 if (EXT4_MB_GRP_TEST_AND_SET_READ(grp)) 2150 goto next; 2151 2152 /* ignore empty groups - those will be skipped 2153 * during the scanning as well */ 2154 if (grp->bb_free > 0 && EXT4_MB_GRP_NEED_INIT(grp)) { 2155 bh = ext4_read_block_bitmap_nowait(sb, group, true); 2156 if (bh && !IS_ERR(bh)) { 2157 if (!buffer_uptodate(bh)) 2158 ac->ac_prefetch_ios++; 2159 brelse(bh); 2160 } 2161 } 2162 next: 2163 if (++group >= ngroups) 2164 group = 0; 2165 } 2166 ac->ac_prefetch = group; 2167 } 2168 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip