linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* io_uring is zero copy or not?
@ 2019-04-15  3:09 Feng Li
  2019-04-15  3:25 ` Dongli Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Feng Li @ 2019-04-15  3:09 UTC (permalink / raw)
  To: Jens Axboe, linux-block

Hi Jens,

I'm interested in the io_uring, and have a doubt about it.
If I setup io_uring with IORING_REGISTER_BUFFERS,
the kernel doesn't need copy data from user space to the kernel, right?
Does it mean this is a zero-copy feature?

From the code, kernel directly get the userspace virtual address's
pages and store them:

2475 pret = get_user_pages_longterm(ubuf, nr_pages, FOLL_WRITE,
2476 pages, vmas);



-- 
Thanks and Best Regards,
Feng Li(Alex)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: io_uring is zero copy or not?
  2019-04-15  3:09 io_uring is zero copy or not? Feng Li
@ 2019-04-15  3:25 ` Dongli Zhang
  2019-04-15  5:11   ` Feng Li
  0 siblings, 1 reply; 3+ messages in thread
From: Dongli Zhang @ 2019-04-15  3:25 UTC (permalink / raw)
  To: Feng Li; +Cc: Jens Axboe, linux-block



On 4/15/19 11:09 AM, Feng Li wrote:
> Hi Jens,
> 
> I'm interested in the io_uring, and have a doubt about it.
> If I setup io_uring with IORING_REGISTER_BUFFERS,
> the kernel doesn't need copy data from user space to the kernel, right?
> Does it mean this is a zero-copy feature?

Doesn't it depends on the definition of 'copy'?

There is still a copy from original userspace pages to the registered buffer?

Dongli Zhang

> 
> From the code, kernel directly get the userspace virtual address's
> pages and store them:
> 
> 2475 pret = get_user_pages_longterm(ubuf, nr_pages, FOLL_WRITE,
> 2476 pages, vmas);
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: io_uring is zero copy or not?
  2019-04-15  3:25 ` Dongli Zhang
@ 2019-04-15  5:11   ` Feng Li
  0 siblings, 0 replies; 3+ messages in thread
From: Feng Li @ 2019-04-15  5:11 UTC (permalink / raw)
  To: Dongli Zhang; +Cc: Jens Axboe, linux-block

Hi DongLi,

Thanks for your response.

The 'copy' means the data from userspace buffer could be direct to be
written to the device.
The kernel doesn't need to allocate a new buffer and copy the data in it.
Copy data is a wast for performance.

I don't know the block layer need to allocate a new buffer or not.
From the io_uring.c code, the kernel directly grab the pages of
userspace data buffer through the `get_user_pages`.

Dongli Zhang <dongli.zhang@oracle.com> 于2019年4月15日周一 上午11:21写道:
>
>
>
> On 4/15/19 11:09 AM, Feng Li wrote:
> > Hi Jens,
> >
> > I'm interested in the io_uring, and have a doubt about it.
> > If I setup io_uring with IORING_REGISTER_BUFFERS,
> > the kernel doesn't need copy data from user space to the kernel, right?
> > Does it mean this is a zero-copy feature?
>
> Doesn't it depends on the definition of 'copy'?
>
> There is still a copy from original userspace pages to the registered buffer?
>
> Dongli Zhang
>
> >
> > From the code, kernel directly get the userspace virtual address's
> > pages and store them:
> >
> > 2475 pret = get_user_pages_longterm(ubuf, nr_pages, FOLL_WRITE,
> > 2476 pages, vmas);
> >
> >
> >



-- 
Thanks and Best Regards,
Feng Li(Alex)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-15  5:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15  3:09 io_uring is zero copy or not? Feng Li
2019-04-15  3:25 ` Dongli Zhang
2019-04-15  5:11   ` Feng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).