Re: [PATCH] /dev/mem: nowait zero/null ops

From: Pavel Begunkov
Date: Wed Sep 08 2021 - 06:55:33 EST


On 9/8/21 11:25 AM, Greg Kroah-Hartman wrote:
> On Wed, Sep 08, 2021 at 11:06:51AM +0100, Pavel Begunkov wrote:
>> Make read_iter_zero() to honor IOCB_NOWAIT, so /dev/zero can be
>> advertised as FMODE_NOWAIT. This helps subsystems like io_uring to use
>> it more effectively. Set FMODE_NOWAIT for /dev/null as well, it never
>> waits and therefore trivially meets the criteria.
>
> I do not understand, why would io_uring need to use /dev/zero

Not directly, users can issue I/O against it via io_uring.

> and how is this going to help anything?

For files not supporting nowait io_uring goes through a quite slow path.

> What workload does this help with?

Personally for me it's dumping output and benchmarking (not benchmarking
/dev/zero, of course). But I'd also expect any tool that may be using
it but rewritten with io_uring being able to normally use it without a
performance hit.

--
Pavel Begunkov