Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-14 Thread Benjamin LaHaise
On Wed, Jun 14, 2017 at 12:11:38PM +0300, Kirill Tkhai wrote: > On 14.06.2017 02:26, Benjamin LaHaise wrote: ... > > Nope. An aio may not complete in a timely fashion, in which case your > > wait for all aios to complete will simply wait forever. I take it this is > > not the desired behaviour

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-14 Thread Benjamin LaHaise
On Wed, Jun 14, 2017 at 12:11:38PM +0300, Kirill Tkhai wrote: > On 14.06.2017 02:26, Benjamin LaHaise wrote: ... > > Nope. An aio may not complete in a timely fashion, in which case your > > wait for all aios to complete will simply wait forever. I take it this is > > not the desired behaviour

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-14 Thread Kirill Tkhai
On 14.06.2017 02:26, Benjamin LaHaise wrote: > On Tue, Jun 13, 2017 at 07:17:43PM +0300, Kirill Tkhai wrote: >> On 13.06.2017 18:26, Benjamin LaHaise wrote: >>> On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: >>> ... The functionality, I did, grew from real need and experience.

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-14 Thread Kirill Tkhai
On 14.06.2017 02:26, Benjamin LaHaise wrote: > On Tue, Jun 13, 2017 at 07:17:43PM +0300, Kirill Tkhai wrote: >> On 13.06.2017 18:26, Benjamin LaHaise wrote: >>> On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: >>> ... The functionality, I did, grew from real need and experience.

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Benjamin LaHaise
On Tue, Jun 13, 2017 at 07:17:43PM +0300, Kirill Tkhai wrote: > On 13.06.2017 18:26, Benjamin LaHaise wrote: > > On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: > > ... > >> The functionality, I did, grew from real need and experience. We try to > >> avoid kernel modification, where

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Benjamin LaHaise
On Tue, Jun 13, 2017 at 07:17:43PM +0300, Kirill Tkhai wrote: > On 13.06.2017 18:26, Benjamin LaHaise wrote: > > On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: > > ... > >> The functionality, I did, grew from real need and experience. We try to > >> avoid kernel modification, where

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Kirill Tkhai
On 13.06.2017 18:26, Benjamin LaHaise wrote: > On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: > ... >> The functionality, I did, grew from real need and experience. We try to >> avoid kernel modification, where it's possible, but the in-flight aio >> requests is not a case suitable

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Kirill Tkhai
On 13.06.2017 18:26, Benjamin LaHaise wrote: > On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: > ... >> The functionality, I did, grew from real need and experience. We try to >> avoid kernel modification, where it's possible, but the in-flight aio >> requests is not a case suitable

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Benjamin LaHaise
On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: ... > The functionality, I did, grew from real need and experience. We try to > avoid kernel modification, where it's possible, but the in-flight aio > requests is not a case suitable for that. What you've done only works for *your*

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Benjamin LaHaise
On Tue, Jun 13, 2017 at 06:11:03PM +0300, Kirill Tkhai wrote: ... > The functionality, I did, grew from real need and experience. We try to > avoid kernel modification, where it's possible, but the in-flight aio > requests is not a case suitable for that. What you've done only works for *your*

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Kirill Tkhai
On 13.06.2017 17:42, Benjamin LaHaise wrote: > On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: >> During implementation aio support for Checkpoint-Restore >> in Userspace project (CRIU), we found, that current >> kernel functionality does not allow to wait for >> completion of all

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Kirill Tkhai
On 13.06.2017 17:42, Benjamin LaHaise wrote: > On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: >> During implementation aio support for Checkpoint-Restore >> in Userspace project (CRIU), we found, that current >> kernel functionality does not allow to wait for >> completion of all

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Benjamin LaHaise
On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: > During implementation aio support for Checkpoint-Restore > in Userspace project (CRIU), we found, that current > kernel functionality does not allow to wait for > completion of all submitted requests. Checkpoint software > can't

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Benjamin LaHaise
On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: > During implementation aio support for Checkpoint-Restore > in Userspace project (CRIU), we found, that current > kernel functionality does not allow to wait for > completion of all submitted requests. Checkpoint software > can't

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Cyrill Gorcunov
On Tue, Jun 13, 2017 at 12:45:39PM +0300, Kirill Tkhai wrote: > > > > I'm not that familiar with AIO internals but this snippet worries me: > > the reqs_available is unsigned int, reqs is unsigned it as well but > > used as an accumulator over ALL cpus, can't it get overflow and > > gives modulo

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Cyrill Gorcunov
On Tue, Jun 13, 2017 at 12:45:39PM +0300, Kirill Tkhai wrote: > > > > I'm not that familiar with AIO internals but this snippet worries me: > > the reqs_available is unsigned int, reqs is unsigned it as well but > > used as an accumulator over ALL cpus, can't it get overflow and > > gives modulo

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Kirill Tkhai
On 13.06.2017 11:14, Cyrill Gorcunov wrote: > On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: > ... >> +static int aio_wait_all(struct kioctx *ctx) >> +{ >> +unsigned users, reqs = 0; >> +struct kioctx_cpu *kcpu; >> +int cpu, ret; >> + >> +if (atomic_xchg(>dead, 1))

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Kirill Tkhai
On 13.06.2017 11:14, Cyrill Gorcunov wrote: > On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: > ... >> +static int aio_wait_all(struct kioctx *ctx) >> +{ >> +unsigned users, reqs = 0; >> +struct kioctx_cpu *kcpu; >> +int cpu, ret; >> + >> +if (atomic_xchg(>dead, 1))

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Cyrill Gorcunov
On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: ... > +static int aio_wait_all(struct kioctx *ctx) > +{ > + unsigned users, reqs = 0; > + struct kioctx_cpu *kcpu; > + int cpu, ret; > + > + if (atomic_xchg(>dead, 1)) > + return -EBUSY; > + > + users =

Re: [PATCH] aio: Add command to wait completion of all requests

2017-06-13 Thread Cyrill Gorcunov
On Fri, Jun 09, 2017 at 12:49:34PM +0300, Kirill Tkhai wrote: ... > +static int aio_wait_all(struct kioctx *ctx) > +{ > + unsigned users, reqs = 0; > + struct kioctx_cpu *kcpu; > + int cpu, ret; > + > + if (atomic_xchg(>dead, 1)) > + return -EBUSY; > + > + users =

[PATCH] aio: Add command to wait completion of all requests

2017-06-09 Thread Kirill Tkhai
During implementation aio support for Checkpoint-Restore in Userspace project (CRIU), we found, that current kernel functionality does not allow to wait for completion of all submitted requests. Checkpoint software can't determine if there is no in-flight requests, i.e. the process aio rings

[PATCH] aio: Add command to wait completion of all requests

2017-06-09 Thread Kirill Tkhai
During implementation aio support for Checkpoint-Restore in Userspace project (CRIU), we found, that current kernel functionality does not allow to wait for completion of all submitted requests. Checkpoint software can't determine if there is no in-flight requests, i.e. the process aio rings