block/blk-iocost.c:1183:6: warning: variable 'last_period' set but not used

From: kernel test robot
Date: Wed Jan 10 2024 - 10:20:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ab27740f76654ed58dd32ac0ba0031c18a6dea3b
commit: ac33e91e2daca40fcad66c68712276da7b40f169 blk-iocost: implement vtime loss compensation
date: 3 years, 4 months ago
config: x86_64-buildonly-randconfig-001-20240107 (https://download.01.org/0day-ci/archive/20240110/202401102335.GiWdeIo9-lkp@xxxxxxxxx/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240110/202401102335.GiWdeIo9-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401102335.GiWdeIo9-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> block/blk-iocost.c:1183:6: warning: variable 'last_period' set but not used [-Wunused-but-set-variable]
1183 | u64 last_period, cur_period;
| ^
1 warning generated.


vim +/last_period +1183 block/blk-iocost.c

1179
1180 static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
1181 {
1182 struct ioc *ioc = iocg->ioc;
> 1183 u64 last_period, cur_period;
1184 u64 vtime, vtarget;
1185 int i;
1186
1187 /*
1188 * If seem to be already active, just update the stamp to tell the
1189 * timer that we're still active. We don't mind occassional races.
1190 */
1191 if (!list_empty(&iocg->active_list)) {
1192 ioc_now(ioc, now);
1193 cur_period = atomic64_read(&ioc->cur_period);
1194 if (atomic64_read(&iocg->active_period) != cur_period)
1195 atomic64_set(&iocg->active_period, cur_period);
1196 return true;
1197 }
1198
1199 /* racy check on internal node IOs, treat as root level IOs */
1200 if (iocg->child_active_sum)
1201 return false;
1202
1203 spin_lock_irq(&ioc->lock);
1204
1205 ioc_now(ioc, now);
1206
1207 /* update period */
1208 cur_period = atomic64_read(&ioc->cur_period);
1209 last_period = atomic64_read(&iocg->active_period);
1210 atomic64_set(&iocg->active_period, cur_period);
1211
1212 /* already activated or breaking leaf-only constraint? */
1213 if (!list_empty(&iocg->active_list))
1214 goto succeed_unlock;
1215 for (i = iocg->level - 1; i > 0; i--)
1216 if (!list_empty(&iocg->ancestors[i]->active_list))
1217 goto fail_unlock;
1218
1219 if (iocg->child_active_sum)
1220 goto fail_unlock;
1221
1222 /*
1223 * Always start with the target budget. On deactivation, we throw away
1224 * anything above it.
1225 */
1226 vtarget = now->vnow - ioc->margins.target;
1227 vtime = atomic64_read(&iocg->vtime);
1228
1229 atomic64_add(vtarget - vtime, &iocg->vtime);
1230 atomic64_add(vtarget - vtime, &iocg->done_vtime);
1231 vtime = vtarget;
1232
1233 /*
1234 * Activate, propagate weight and start period timer if not
1235 * running. Reset hweight_gen to avoid accidental match from
1236 * wrapping.
1237 */
1238 iocg->hweight_gen = atomic_read(&ioc->hweight_gen) - 1;
1239 list_add(&iocg->active_list, &ioc->active_iocgs);
1240
1241 propagate_weights(iocg, iocg->weight,
1242 iocg->last_inuse ?: iocg->weight, true, now);
1243
1244 TRACE_IOCG_PATH(iocg_activate, iocg, now,
1245 last_period, cur_period, vtime);
1246
1247 iocg->activated_at = now->now;
1248
1249 if (ioc->running == IOC_IDLE) {
1250 ioc->running = IOC_RUNNING;
1251 ioc->debt_busy_at = now->now;
1252 ioc_start_period(ioc, now);
1253 }
1254
1255 succeed_unlock:
1256 spin_unlock_irq(&ioc->lock);
1257 return true;
1258
1259 fail_unlock:
1260 spin_unlock_irq(&ioc->lock);
1261 return false;
1262 }
1263

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki