* [PATCH] autofs4: use wake_up() instead of wake_up_interruptible @ 2018-03-31 2:28 Andrei Vagin 2018-04-01 1:31 ` Ian Kent 0 siblings, 1 reply; 5+ messages in thread From: Andrei Vagin @ 2018-03-31 2:28 UTC (permalink / raw) To: Ian Kent Cc: autofs, linux-kernel, Andrei Vagin, Matthew Wilcox, Andrew Morton, Stephen Rothwell In "autofs4: use wait_event_killable", wait_event_interruptible() was replaced by wait_event_killable(), but in this case we have to use wake_up() instead of wake_up_interruptible(). Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: Ian Kent <raven@themaw.net> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrei Vagin <avagin@openvz.org> --- fs/autofs4/waitq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index c160e9b3aa0f..be9c3dc048ab 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -549,7 +549,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok kfree(wq->name.name); wq->name.name = NULL; /* Do not wait on this queue */ wq->status = status; - wake_up_interruptible(&wq->queue); + wake_up(&wq->queue); if (!--wq->wait_ctr) kfree(wq); mutex_unlock(&sbi->wq_mutex); -- 2.13.6 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] autofs4: use wake_up() instead of wake_up_interruptible 2018-03-31 2:28 [PATCH] autofs4: use wake_up() instead of wake_up_interruptible Andrei Vagin @ 2018-04-01 1:31 ` Ian Kent 2018-04-01 2:01 ` Ian Kent 0 siblings, 1 reply; 5+ messages in thread From: Ian Kent @ 2018-04-01 1:31 UTC (permalink / raw) To: Andrei Vagin Cc: autofs, linux-kernel, Matthew Wilcox, Andrew Morton, Stephen Rothwell On 31/03/18 10:28, Andrei Vagin wrote: > In "autofs4: use wait_event_killable", wait_event_interruptible() was > replaced by wait_event_killable(), but in this case we have to use > wake_up() instead of wake_up_interruptible(). Why do you believe wake_up() is needed rather than wake_up_interruptible()? Now that I'm thinking about the wake up I'm wondering if this is in fact what's needed. Rather, I think maybe wake_up_all() is probably the only one that will actually do what's needed. There's an individual wait queue for each mount, there can be multiple waiters for a mount, they all should be woken up when the daemon signals mount completion. > > Cc: Matthew Wilcox <mawilcox@microsoft.com> > Cc: Ian Kent <raven@themaw.net> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Stephen Rothwell <sfr@canb.auug.org.au> > Signed-off-by: Andrei Vagin <avagin@openvz.org> > --- > fs/autofs4/waitq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c > index c160e9b3aa0f..be9c3dc048ab 100644 > --- a/fs/autofs4/waitq.c > +++ b/fs/autofs4/waitq.c > @@ -549,7 +549,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok > kfree(wq->name.name); > wq->name.name = NULL; /* Do not wait on this queue */ > wq->status = status; > - wake_up_interruptible(&wq->queue); > + wake_up(&wq->queue); > if (!--wq->wait_ctr) > kfree(wq); > mutex_unlock(&sbi->wq_mutex); > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] autofs4: use wake_up() instead of wake_up_interruptible 2018-04-01 1:31 ` Ian Kent @ 2018-04-01 2:01 ` Ian Kent 2018-04-01 6:21 ` Andrei Vagin 0 siblings, 1 reply; 5+ messages in thread From: Ian Kent @ 2018-04-01 2:01 UTC (permalink / raw) To: Andrei Vagin Cc: autofs, linux-kernel, Matthew Wilcox, Andrew Morton, Stephen Rothwell On 01/04/18 09:31, Ian Kent wrote: > On 31/03/18 10:28, Andrei Vagin wrote: >> In "autofs4: use wait_event_killable", wait_event_interruptible() was >> replaced by wait_event_killable(), but in this case we have to use >> wake_up() instead of wake_up_interruptible(). > > Why do you believe wake_up() is needed rather than wake_up_interruptible()? > > Now that I'm thinking about the wake up I'm wondering if this is in fact > what's needed. Rather, I think maybe wake_up_all() is probably the only > one that will actually do what's needed. Ok, so that 1 is the number of exclusive waiters. So what is the difference between the two wake_up calls in this case? > > There's an individual wait queue for each mount, there can be multiple > waiters for a mount, they all should be woken up when the daemon signals > mount completion. > >> >> Cc: Matthew Wilcox <mawilcox@microsoft.com> >> Cc: Ian Kent <raven@themaw.net> >> Cc: Andrew Morton <akpm@linux-foundation.org> >> Cc: Stephen Rothwell <sfr@canb.auug.org.au> >> Signed-off-by: Andrei Vagin <avagin@openvz.org> >> --- >> fs/autofs4/waitq.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c >> index c160e9b3aa0f..be9c3dc048ab 100644 >> --- a/fs/autofs4/waitq.c >> +++ b/fs/autofs4/waitq.c >> @@ -549,7 +549,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok >> kfree(wq->name.name); >> wq->name.name = NULL; /* Do not wait on this queue */ >> wq->status = status; >> - wake_up_interruptible(&wq->queue); >> + wake_up(&wq->queue); >> if (!--wq->wait_ctr) >> kfree(wq); >> mutex_unlock(&sbi->wq_mutex); >> > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] autofs4: use wake_up() instead of wake_up_interruptible 2018-04-01 2:01 ` Ian Kent @ 2018-04-01 6:21 ` Andrei Vagin 2018-04-02 23:39 ` Ian Kent 0 siblings, 1 reply; 5+ messages in thread From: Andrei Vagin @ 2018-04-01 6:21 UTC (permalink / raw) To: Ian Kent Cc: Andrei Vagin, autofs, linux-kernel, Matthew Wilcox, Andrew Morton, Stephen Rothwell On Sun, Apr 01, 2018 at 10:01:41AM +0800, Ian Kent wrote: > On 01/04/18 09:31, Ian Kent wrote: > > On 31/03/18 10:28, Andrei Vagin wrote: > >> In "autofs4: use wait_event_killable", wait_event_interruptible() was > >> replaced by wait_event_killable(), but in this case we have to use > >> wake_up() instead of wake_up_interruptible(). > > > > Why do you believe wake_up() is needed rather than wake_up_interruptible()? > > > > Now that I'm thinking about the wake up I'm wondering if this is in fact > > what's needed. Rather, I think maybe wake_up_all() is probably the only > > one that will actually do what's needed. > > Ok, so that 1 is the number of exclusive waiters. > So what is the difference between the two wake_up calls in this case? In CRIU, we have the autofs test: https://github.com/checkpoint-restore/criu/blob/master/test/zdtm/static/autofs.c We run CRIU tests on the linux-next kernels and a few days ago this test started to fail, actually it hangs up. I found that wake_up_interruptible() doesn't wake up a thread, which is waiting. try_to_wake_up() has the argument "state", it is the mask of task states that can be woken. For wake_up_interruptible(), state is TASK_INTERRUPTIBLE. For wake_up(). state is TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) If we use wait_event_killable(), the task sleeps in the TASK_KILLABLE state, so wake_up_interruptible() isn't suitable in this case. #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) I checked that our test passes with this patch. I mean that we had a real problem and we checked that it is fixed by this patch. Thanks, Andrei > > > > > There's an individual wait queue for each mount, there can be multiple > > waiters for a mount, they all should be woken up when the daemon signals > > mount completion. > > > >> > >> Cc: Matthew Wilcox <mawilcox@microsoft.com> > >> Cc: Ian Kent <raven@themaw.net> > >> Cc: Andrew Morton <akpm@linux-foundation.org> > >> Cc: Stephen Rothwell <sfr@canb.auug.org.au> > >> Signed-off-by: Andrei Vagin <avagin@openvz.org> > >> --- > >> fs/autofs4/waitq.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c > >> index c160e9b3aa0f..be9c3dc048ab 100644 > >> --- a/fs/autofs4/waitq.c > >> +++ b/fs/autofs4/waitq.c > >> @@ -549,7 +549,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok > >> kfree(wq->name.name); > >> wq->name.name = NULL; /* Do not wait on this queue */ > >> wq->status = status; > >> - wake_up_interruptible(&wq->queue); > >> + wake_up(&wq->queue); > >> if (!--wq->wait_ctr) > >> kfree(wq); > >> mutex_unlock(&sbi->wq_mutex); > >> > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] autofs4: use wake_up() instead of wake_up_interruptible 2018-04-01 6:21 ` Andrei Vagin @ 2018-04-02 23:39 ` Ian Kent 0 siblings, 0 replies; 5+ messages in thread From: Ian Kent @ 2018-04-02 23:39 UTC (permalink / raw) To: Andrei Vagin, Andrew Morton Cc: Andrei Vagin, autofs, linux-kernel, Matthew Wilcox, Stephen Rothwell On 01/04/18 14:21, Andrei Vagin wrote: > On Sun, Apr 01, 2018 at 10:01:41AM +0800, Ian Kent wrote: >> On 01/04/18 09:31, Ian Kent wrote: >>> On 31/03/18 10:28, Andrei Vagin wrote: >>>> In "autofs4: use wait_event_killable", wait_event_interruptible() was >>>> replaced by wait_event_killable(), but in this case we have to use >>>> wake_up() instead of wake_up_interruptible(). >>> >>> Why do you believe wake_up() is needed rather than wake_up_interruptible()? >>> >>> Now that I'm thinking about the wake up I'm wondering if this is in fact >>> what's needed. Rather, I think maybe wake_up_all() is probably the only >>> one that will actually do what's needed. >> >> Ok, so that 1 is the number of exclusive waiters. >> So what is the difference between the two wake_up calls in this case? > > In CRIU, we have the autofs test: > https://github.com/checkpoint-restore/criu/blob/master/test/zdtm/static/autofs.c > > We run CRIU tests on the linux-next kernels and a few days ago this test > started to fail, actually it hangs up. > > I found that wake_up_interruptible() doesn't wake up a thread, which is > waiting. > > try_to_wake_up() has the argument "state", it is the mask of task states > that can be woken. > > For wake_up_interruptible(), state is TASK_INTERRUPTIBLE. > For wake_up(). state is TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE) > > If we use wait_event_killable(), the task sleeps in the TASK_KILLABLE > state, so wake_up_interruptible() isn't suitable in this case. > > #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) > > I checked that our test passes with this patch. I mean that we had a > real problem and we checked that it is fixed by this patch. Ahh, I see, wake_up_*() functions do just what they say, they skip TASK_UNINTERRUPTIBLE tasks. Now it makes sense. Acked-by: Ian Kent <raven@themaw.net> Andrew could you a take this patch as well please. > > Thanks, > Andrei > >> >>> >>> There's an individual wait queue for each mount, there can be multiple >>> waiters for a mount, they all should be woken up when the daemon signals >>> mount completion. >>> >>>> >>>> Cc: Matthew Wilcox <mawilcox@microsoft.com> >>>> Cc: Ian Kent <raven@themaw.net> >>>> Cc: Andrew Morton <akpm@linux-foundation.org> >>>> Cc: Stephen Rothwell <sfr@canb.auug.org.au> >>>> Signed-off-by: Andrei Vagin <avagin@openvz.org> >>>> --- >>>> fs/autofs4/waitq.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c >>>> index c160e9b3aa0f..be9c3dc048ab 100644 >>>> --- a/fs/autofs4/waitq.c >>>> +++ b/fs/autofs4/waitq.c >>>> @@ -549,7 +549,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok >>>> kfree(wq->name.name); >>>> wq->name.name = NULL; /* Do not wait on this queue */ >>>> wq->status = status; >>>> - wake_up_interruptible(&wq->queue); >>>> + wake_up(&wq->queue); >>>> if (!--wq->wait_ctr) >>>> kfree(wq); >>>> mutex_unlock(&sbi->wq_mutex); >>>> >>> >> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-02 23:39 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-03-31 2:28 [PATCH] autofs4: use wake_up() instead of wake_up_interruptible Andrei Vagin 2018-04-01 1:31 ` Ian Kent 2018-04-01 2:01 ` Ian Kent 2018-04-01 6:21 ` Andrei Vagin 2018-04-02 23:39 ` Ian Kent
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).