* [linux-next:master 5568/5998] block/genhd.c:150:23-24: WARNING opportunity for max()
@ 2025-06-27 15:10 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-06-27 15:10 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Julia Lawall
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Yu Kuai <yukuai3@huawei.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Christoph Hellwig <hch@lst.de>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 2aeda9592360c200085898a258c4754bfe879921
commit: c007062188d8e402c294117db53a24b2bed2b83f [5568/5998] block: fix false warning in bdev_count_inflight_rw()
:::::: branch date: 6 hours ago
:::::: commit date: 26 hours ago
config: x86_64-randconfig-101-20250627 (https://download.01.org/0day-ci/archive/20250627/202506272336.CvAqaAxB-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
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@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202506272336.CvAqaAxB-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> block/genhd.c:150:23-24: WARNING opportunity for max()
block/genhd.c:151:25-26: WARNING opportunity for max()
vim +150 block/genhd.c
ea18e0f0a63af9 Konstantin Khlebnikov 2020-03-25 127
f2987c5816bda0 Yu Kuai 2025-05-06 128 static void bdev_count_inflight_rw(struct block_device *part,
6b6c3a97abdebf Yu Kuai 2025-05-06 129 unsigned int inflight[2], bool mq_driver)
bf0ddaba65ddbb Omar Sandoval 2018-04-26 130 {
c007062188d8e4 Yu Kuai 2025-06-26 131 int write = 0;
c007062188d8e4 Yu Kuai 2025-06-26 132 int read = 0;
1226b8dd0e9133 Mikulas Patocka 2018-12-06 133 int cpu;
1226b8dd0e9133 Mikulas Patocka 2018-12-06 134
6b6c3a97abdebf Yu Kuai 2025-05-06 135 if (mq_driver) {
6b6c3a97abdebf Yu Kuai 2025-05-06 136 blk_mq_in_driver_rw(part, inflight);
c007062188d8e4 Yu Kuai 2025-06-26 137 return;
6b6c3a97abdebf Yu Kuai 2025-05-06 138 }
c007062188d8e4 Yu Kuai 2025-06-26 139
c007062188d8e4 Yu Kuai 2025-06-26 140 for_each_possible_cpu(cpu) {
c007062188d8e4 Yu Kuai 2025-06-26 141 read += part_stat_local_read_cpu(part, in_flight[READ], cpu);
c007062188d8e4 Yu Kuai 2025-06-26 142 write += part_stat_local_read_cpu(part, in_flight[WRITE], cpu);
1226b8dd0e9133 Mikulas Patocka 2018-12-06 143 }
6b6c3a97abdebf Yu Kuai 2025-05-06 144
c007062188d8e4 Yu Kuai 2025-06-26 145 /*
c007062188d8e4 Yu Kuai 2025-06-26 146 * While iterating all CPUs, some IOs may be issued from a CPU already
c007062188d8e4 Yu Kuai 2025-06-26 147 * traversed and complete on a CPU that has not yet been traversed,
c007062188d8e4 Yu Kuai 2025-06-26 148 * causing the inflight number to be negative.
c007062188d8e4 Yu Kuai 2025-06-26 149 */
c007062188d8e4 Yu Kuai 2025-06-26 @150 inflight[READ] = read > 0 ? read : 0;
c007062188d8e4 Yu Kuai 2025-06-26 151 inflight[WRITE] = write > 0 ? write : 0;
bf0ddaba65ddbb Omar Sandoval 2018-04-26 152 }
bf0ddaba65ddbb Omar Sandoval 2018-04-26 153
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-06-27 15:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 15:10 [linux-next:master 5568/5998] block/genhd.c:150:23-24: WARNING opportunity for max() kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.