[block:for-5.15/io_uring 89/89] fs/io-wq.c:517:8: warning: variable 'stalled' set but not used

From: kernel test robot
Date: Mon Aug 30 2021 - 19:02:59 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.15/io_uring
head: 13b65111bae0c99bae7831138c8f440adf830d3a
commit: 13b65111bae0c99bae7831138c8f440adf830d3a [89/89] io-wq: stall test patch
config: um-x86_64_defconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=13b65111bae0c99bae7831138c8f440adf830d3a
git remote add block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags block for-5.15/io_uring
git checkout 13b65111bae0c99bae7831138c8f440adf830d3a
# save the attached .config to linux build tree
make W=1 ARCH=um SUBARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/io-wq.c: In function 'io_worker_handle_work':
>> fs/io-wq.c:517:8: warning: variable 'stalled' set but not used [-Wunused-but-set-variable]
517 | bool stalled;
| ^~~~~~~


vim +/stalled +517 fs/io-wq.c

60cf46ae605446 Pavel Begunkov 2020-03-14 506
13b65111bae0c9 Jens Axboe 2021-08-30 507 static bool io_worker_handle_work(struct io_worker *worker)
771b53d033e866 Jens Axboe 2019-10-22 508 __releases(wqe->lock)
771b53d033e866 Jens Axboe 2019-10-22 509 {
771b53d033e866 Jens Axboe 2019-10-22 510 struct io_wqe *wqe = worker->wqe;
771b53d033e866 Jens Axboe 2019-10-22 511 struct io_wq *wq = wqe->wq;
c60eb049f4a19d Pavel Begunkov 2021-04-08 512 bool do_kill = test_bit(IO_WQ_BIT_EXIT, &wq->state);
13b65111bae0c9 Jens Axboe 2021-08-30 513 bool did_work = false;
771b53d033e866 Jens Axboe 2019-10-22 514
771b53d033e866 Jens Axboe 2019-10-22 515 do {
86f3cd1b589a10 Pavel Begunkov 2020-03-23 516 struct io_wq_work *work;
ecc53c48c13d99 Jens Axboe 2021-08-29 @517 bool stalled;
f462fd36fc4366 Pavel Begunkov 2020-03-04 518 get_next:
771b53d033e866 Jens Axboe 2019-10-22 519 /*
771b53d033e866 Jens Axboe 2019-10-22 520 * If we got some work, mark us as busy. If we didn't, but
771b53d033e866 Jens Axboe 2019-10-22 521 * the list isn't empty, it means we stalled on hashed work.
771b53d033e866 Jens Axboe 2019-10-22 522 * Mark us stalled so we don't keep looking for work when we
771b53d033e866 Jens Axboe 2019-10-22 523 * can't make progress, any work completion or insertion will
771b53d033e866 Jens Axboe 2019-10-22 524 * clear the stalled flag.
771b53d033e866 Jens Axboe 2019-10-22 525 */
ecc53c48c13d99 Jens Axboe 2021-08-29 526 stalled = false;
13b65111bae0c9 Jens Axboe 2021-08-30 527 work = io_get_next_work(wqe, worker);
771b53d033e866 Jens Axboe 2019-10-22 528 if (work)
771b53d033e866 Jens Axboe 2019-10-22 529 __io_worker_busy(wqe, worker, work);
13b65111bae0c9 Jens Axboe 2021-08-30 530 else if (!wq_list_empty(&wqe->work_list))
771b53d033e866 Jens Axboe 2019-10-22 531 wqe->flags |= IO_WQE_FLAG_STALLED;
771b53d033e866 Jens Axboe 2019-10-22 532
a9a4aa9fbfc5b8 Jens Axboe 2021-08-30 533 raw_spin_unlock(&wqe->lock);
771b53d033e866 Jens Axboe 2019-10-22 534 if (!work)
771b53d033e866 Jens Axboe 2019-10-22 535 break;
13b65111bae0c9 Jens Axboe 2021-08-30 536 did_work = true;
58e3931987377d Pavel Begunkov 2020-03-04 537 io_assign_current_work(worker, work);
e941894eae31b5 Jens Axboe 2021-02-19 538 __set_current_state(TASK_RUNNING);
fd1c4bc6e9b34a Hillf Danton 2019-12-24 539
dc026a73c7221b Pavel Begunkov 2020-03-04 540 /* handle a whole dependent link */
dc026a73c7221b Pavel Begunkov 2020-03-04 541 do {
5280f7e530f71b Pavel Begunkov 2021-02-04 542 struct io_wq_work *next_hashed, *linked;
b089ed390b5c9b Pavel Begunkov 2020-07-25 543 unsigned int hash = io_get_work_hash(work);
36c2f9223e84c1 Jens Axboe 2019-11-13 544
86f3cd1b589a10 Pavel Begunkov 2020-03-23 545 next_hashed = wq_next_work(work);
c60eb049f4a19d Pavel Begunkov 2021-04-08 546
c60eb049f4a19d Pavel Begunkov 2021-04-08 547 if (unlikely(do_kill) && (work->flags & IO_WQ_WORK_UNBOUND))
c60eb049f4a19d Pavel Begunkov 2021-04-08 548 work->flags |= IO_WQ_WORK_CANCEL;
5280f7e530f71b Pavel Begunkov 2021-02-04 549 wq->do_work(work);
5280f7e530f71b Pavel Begunkov 2021-02-04 550 io_assign_current_work(worker, NULL);
771b53d033e866 Jens Axboe 2019-10-22 551
5280f7e530f71b Pavel Begunkov 2021-02-04 552 linked = wq->free_work(work);
86f3cd1b589a10 Pavel Begunkov 2020-03-23 553 work = next_hashed;
86f3cd1b589a10 Pavel Begunkov 2020-03-23 554 if (!work && linked && !io_wq_is_hashed(linked)) {
86f3cd1b589a10 Pavel Begunkov 2020-03-23 555 work = linked;
86f3cd1b589a10 Pavel Begunkov 2020-03-23 556 linked = NULL;
86f3cd1b589a10 Pavel Begunkov 2020-03-23 557 }
86f3cd1b589a10 Pavel Begunkov 2020-03-23 558 io_assign_current_work(worker, work);
86f3cd1b589a10 Pavel Begunkov 2020-03-23 559 if (linked)
86f3cd1b589a10 Pavel Begunkov 2020-03-23 560 io_wqe_enqueue(wqe, linked);
86f3cd1b589a10 Pavel Begunkov 2020-03-23 561
86f3cd1b589a10 Pavel Begunkov 2020-03-23 562 if (hash != -1U && !next_hashed) {
e941894eae31b5 Jens Axboe 2021-02-19 563 clear_bit(hash, &wq->hash->map);
e941894eae31b5 Jens Axboe 2021-02-19 564 if (wq_has_sleeper(&wq->hash->wait))
e941894eae31b5 Jens Axboe 2021-02-19 565 wake_up(&wq->hash->wait);
a9a4aa9fbfc5b8 Jens Axboe 2021-08-30 566 raw_spin_lock(&wqe->lock);
771b53d033e866 Jens Axboe 2019-10-22 567 wqe->flags &= ~IO_WQE_FLAG_STALLED;
f462fd36fc4366 Pavel Begunkov 2020-03-04 568 /* skip unnecessary unlock-lock wqe->lock */
f462fd36fc4366 Pavel Begunkov 2020-03-04 569 if (!work)
f462fd36fc4366 Pavel Begunkov 2020-03-04 570 goto get_next;
a9a4aa9fbfc5b8 Jens Axboe 2021-08-30 571 raw_spin_unlock(&wqe->lock);
771b53d033e866 Jens Axboe 2019-10-22 572 }
58e3931987377d Pavel Begunkov 2020-03-04 573 } while (work);
dc026a73c7221b Pavel Begunkov 2020-03-04 574
a9a4aa9fbfc5b8 Jens Axboe 2021-08-30 575 raw_spin_lock(&wqe->lock);
771b53d033e866 Jens Axboe 2019-10-22 576 } while (1);
13b65111bae0c9 Jens Axboe 2021-08-30 577
13b65111bae0c9 Jens Axboe 2021-08-30 578 return did_work;
771b53d033e866 Jens Axboe 2019-10-22 579 }
771b53d033e866 Jens Axboe 2019-10-22 580

:::::: The code at line 517 was first introduced by commit
:::::: ecc53c48c13d995e6fe5559e30ffee48d92784fd io-wq: check max_worker limits if a worker transitions bound state

:::::: TO: Jens Axboe <axboe@xxxxxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip