[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy
From: |
Peter Xu |
Subject: |
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy |
Date: |
Tue, 7 Sep 2021 23:24:03 -0400 |
On Wed, Sep 08, 2021 at 10:59:57AM +0800, Jason Wang wrote:
> On Wed, Sep 8, 2021 at 2:32 AM Peter Xu <peterx@redhat.com> wrote:
> >
> > On Thu, Sep 02, 2021 at 04:22:55AM -0300, Leonardo Bras Soares Passos wrote:
> > > > I don't think it is valid to unconditionally enable this feature due to
> > > > the
> > > > resource usage implications
> > > >
> > > > https://www.kernel.org/doc/html/v5.4/networking/msg_zerocopy.html
> > > >
> > > > "A zerocopy failure will return -1 with errno ENOBUFS. This happens
> > > > if the socket option was not set, the socket exceeds its optmem
> > > > limit or the user exceeds its ulimit on locked pages."
> > >
> > > You are correct, I unfortunately missed this part in the docs :(
> > >
> > > > The limit on locked pages is something that looks very likely to be
> > > > exceeded unless you happen to be running a QEMU config that already
> > > > implies locked memory (eg PCI assignment)
> > >
> > > Do you mean the limit an user has on locking memory?
> > >
> > > If so, that makes sense. I remember I needed to set the upper limit of
> > > locked
> > > memory for the user before using it, or adding a capability to qemu
> > > before.
> >
> > So I'm a bit confused on why MSG_ZEROCOPY requires checking RLIMIT_MEMLOCK.
> >
> > The thing is IIUC that's accounting for pinned pages only with either
> > mlock()
> > (FOLL_MLOCK) or vfio (FOLL_PIN).
> >
> > I don't really think MSG_ZEROCOPY is doing that at all... I'm looking at
> > __zerocopy_sg_from_iter() -> iov_iter_get_pages().
>
> It happens probably here:
>
> E.g
>
> __ip_append_data()
> msg_zerocopy_realloc()
> mm_account_pinned_pages()
Right. :)
But my previous question is more about the reason behind it - I thought that's
a common GUP and it shouldn't rely on locked_vm because it should still be
temporary GUP rather than a long time GUP, IMHO that's how we use locked_vm (we
don't account for temp GUPs but only longterm ones). IOW, I'm wondering whether
all the rest of iov_iter_get_pages() callers should check locked_vm too, and
AFAIU they're not doing that right now..
Thanks,
--
Peter Xu
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, (continued)
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Leonardo Bras Soares Passos, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Daniel P . Berrangé, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Leonardo Bras Soares Passos, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Daniel P . Berrangé, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Leonardo Bras Soares Passos, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Daniel P . Berrangé, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Leonardo Bras Soares Passos, 2021/09/02
- Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Dr. David Alan Gilbert, 2021/09/07
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Peter Xu, 2021/09/07
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Dr. David Alan Gilbert, 2021/09/08
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Peter Xu, 2021/09/08
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Jason Wang, 2021/09/08
Re: [PATCH v1 3/3] migration: multifd: Enable zerocopy, Leonardo Bras Soares Passos, 2021/09/02