Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1702208

Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone

From Andrea Arcangeli <aarcange@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone
Date 2017-08-02 18:00 +0200
Message-ID <ua4dX-3lq-1@gated-at.bofh.it> (permalink)
References <u7Kt4-2Ab-7@gated-at.bofh.it> <u9hZF-6eS-13@gated-at.bofh.it> <u9j5n-6QC-1@gated-at.bofh.it> <u9jf3-6U3-1@gated-at.bofh.it> <ua16q-1sn-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 02, 2017 at 03:34:41PM +0300, Mike Rapoport wrote:
> I surely can take care of CRIU, but I don't know if QEMU or certain
> database application that uses userfaultfd rely on this API, not mentioning
> there maybe other unknown users.
> 
> Andrea, what do you think?

The manpage would need updates, from v4.11 to v4.13 -ENOSPC, from v4.1
-ESRCH and I don't see the benefit and it just looks confusion for
nothing, but if somebody feel strongly about it and does the work (and
risks to take the blame if something breaks...) I wouldn't be against
it, it won't make much of a difference anyway.

The reason I don't see any benefit in code readability is that I don't
see ESRCH as an obviously better retval, because if you grep for ESRCH
you'll see it's a failure to find a process with a certain pid, it is
an obvious retval when you're dealing with processes and pids, but we
never search pids and in fact the pid and the process may be already
gone but we still won't return ESRCH. UFFDIO_COPY never takes a pid as
parameter anywhere so why to return ESRCH? ENOSPC shall be interpreted
"no memory avail to copy anything", ESRCH as far as I can tell, could
be as unexpected as ENOSPC is you don't specify a pid as parameter to
the kernel.

If the mm_users is already zero and the mm is gone it means the
process is gone too, that is true, but the process could be gone
already and we could still obtain the mm_users and run UFFDIO_COPY if
there's async I/O pending or something. There's no association between
process/pid being still alive and the need to run a UFFDIO_COPY and
succeed at it.

Not ever dealing with pids and processes is why not even ESRCH is an
obvious perfect match for such an error, and this is why I think such
a change now would add no tangible pros and only short term cons.

Thanks,
Andrea

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Andrea Arcangeli <aarcange@redhat.com> - 2017-07-31 15:40 +0200
  Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Michal Hocko <mhocko@kernel.org> - 2017-07-31 15:50 +0200
    Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Mike Rapoport <rppt@linux.vnet.ibm.com> - 2017-08-02 14:40 +0200
      Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone "Dr. David Alan Gilbert" <dgilbert@redhat.com> - 2017-08-02 15:30 +0200
      Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Andrea Arcangeli <aarcange@redhat.com> - 2017-08-02 18:00 +0200
        Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Michal Hocko <mhocko@kernel.org> - 2017-08-02 18:30 +0200
          Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Andrea Arcangeli <aarcange@redhat.com> - 2017-08-02 18:50 +0200
            Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Mike Rapoport <rppt@linux.vnet.ibm.com> - 2017-08-03 19:30 +0200
              Re: [PATCH] userfaultfd_zeropage: return -ENOSPC in case mm has gone Andrea Arcangeli <aarcange@redhat.com> - 2017-08-03 23:30 +0200

csiph-web