Re: [PATCH] virtio_pci_modern: replace msleep(1) with usleep_range(1000, 2000)

Mirza Ishan Beg <[email protected]>
Newsgroups dev.linux.lists.virtualization,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Sun, Aug 16, 2026 at 05:38:06PM -0400, Michael S. Tsirkin wrote:
> why do we care?

Hi Michael,

The motivation originally came from a checkpatch.pl warning, but looking directly at Documentation/timers/timers-howto.rst, there is a practical penalty here.

The documentation explicitly notes for the 1-20ms range: "msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range)."

In these queue reset loops, using msleep(1) means each iteration may be extended to 10-20ms depending on HZ and timer slack. The document recommends using usleep_range() to avoid this overhead and provide the intended precision.

Let me know if you'd like this explanation folded into a v2 commit message.

--
Mirza
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.