From: Peter Zijlstra <a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw@public.gmane.org>
To: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
Cc: Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Tetsuo Handa
<penguin-kernel-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>,
linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>,
Paul Turner <pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
linux-fsdevel
<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
NFS list <linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Trond Myklebust
<Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
"Bhamare,
Sachin" <sbhamare-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>,
David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Eric Paris <eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Srivatsa S. Bhat"
<srivatsa.bhat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Kay Sievers <kay.sievers-tD+1rO4QERM@public.gmane.org>,
James Morris <jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
Greg KH
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
"keyrings-6DNke4IJHB0gsBAKwltoeQ@public.gmane.org"
<keyrings-6DNke4IJHB0gsBAKwltoeQ@public.gmane.org>
Subject: Re: [PATCH 4/6 OPTION-A version 3] completion: Add new wait_for_completion_timeout_state
Date: Tue, 27 Mar 2012 10:11:59 +0200 [thread overview]
Message-ID: <1332835919.16159.195.camel@twins> (raw)
In-Reply-To: <4F7126E0.5080700-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
On Mon, 2012-03-26 at 19:33 -0700, Boaz Harrosh wrote:
> +int __sched
> +wait_for_completion_timeout_state(struct completion *x,
> + unsigned long timeout, int state)
> +{
> + long t;
> + int ret;
> +
> + if (!timeout)
> + timeout = MAX_SCHEDULE_TIMEOUT;
> +
> + switch (state) {
> + default:
> + WARN_ON_ONCE(1);
> + /* fall through */
> + case 0:
> + state = TASK_UNINTERRUPTIBLE;
> + break;
> + case TASK_KILLABLE:
> + case TASK_INTERRUPTIBLE:
> + break;
> + }
Don't do this, just pass in TASK_UNINTERRUPTIBLE (or TASK_NORMAL)
whatever you like/need.
Don't fudge it by over-loading TASK_RUNNING (aka. 0).
> + t = wait_for_common(x, timeout, state);
> + if (likely(t > 0)) {
> + ret = 0;
> + } else {
> + if (t < 0)
> + ret = t;
> + else
> + ret = -ETIMEDOUT;
> + }
> + return ret;
Again, why wreck an entirely reasonable return code and break with the
rest of the API.
> +}
> +EXPORT_SYMBOL(wait_for_completion_timeout_state);
So I'm fine with adding wait_for_completion_timeout_state(), but make it
look and smell like wait_for_completion_timeout() and use a proper
state, like wake_up_state().
IOW:
unsigned long __sched
wait_for_completion_timeout_state(struct completion *x,
unsigned long timeout,
unsigned int state)
{
return wait_for_common(x, timeout, state);
}
EXPORT_SYMBOL(wait_for_completion_timeout_state);
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-03-27 8:11 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-20 23:18 [PATCHSET 0/4] kmod: Optional timeout on the wait in call_usermodehelper_exec Boaz Harrosh
[not found] ` <4F691059.30405-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-20 23:23 ` [PATCH 1/4] kmod: Un-export call_usermodehelper_freeinfo() Boaz Harrosh
2012-03-20 23:26 ` [PATCH 2/4] kmod: Convert two call sites to call_usermodehelper_fns() Boaz Harrosh
[not found] ` <4F691217.5070108-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-22 3:00 ` James Morris
2012-03-20 23:28 ` [PATCH 3/4] kmod: Move call_usermodehelper_fns() to .c file and unexport it's helpers Boaz Harrosh
2012-03-20 23:32 ` [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout() API Boaz Harrosh
2012-03-22 2:44 ` Boaz Harrosh
2012-03-22 2:48 ` Boaz Harrosh
2012-03-22 2:52 ` Boaz Harrosh
2012-03-22 11:48 ` [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout()API Tetsuo Handa
[not found] ` <4F6A92FC.6060702-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-22 14:27 ` [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout() API Oleg Nesterov
[not found] ` <20120322142758.GA12370-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-03-22 14:42 ` Oleg Nesterov
2012-03-22 19:08 ` Boaz Harrosh
2012-03-22 22:16 ` [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout()API Tetsuo Handa
2012-03-23 4:48 ` Boaz Harrosh
[not found] ` <4F6C0092.1010901-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-23 5:23 ` Tetsuo Handa
2012-03-23 16:30 ` Oleg Nesterov
[not found] ` <4F6B789C.8020201-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-23 13:34 ` [RFC 4/4] {RFC} kmod.c: Add new call_usermodehelper_timeout() API Oleg Nesterov
2012-03-21 15:35 ` [PATCHSET 0/4] kmod: Optional timeout on the wait in call_usermodehelper_exec Greg KH
2012-03-22 0:18 ` Boaz Harrosh
2012-03-22 0:31 ` Myklebust, Trond
2012-03-22 1:18 ` Boaz Harrosh
2012-03-27 1:57 ` [PATCHSET 0/6 version 2] " Boaz Harrosh
[not found] ` <4F711EA2.4030608-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-27 2:00 ` [PATCH 1/6] kmod: Unexport call_usermodehelper_freeinfo() Boaz Harrosh
2012-03-27 2:06 ` [PATCH 4/6 OPTION-A] completion: Add new wait_for_completion_timeout_state Boaz Harrosh
2012-03-27 2:33 ` [PATCH 4/6 OPTION-A version 3] " Boaz Harrosh
[not found] ` <4F7126E0.5080700-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-27 8:11 ` Peter Zijlstra [this message]
2012-03-28 18:19 ` Boaz Harrosh
[not found] ` <4F735642.9030905-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-28 18:25 ` Peter Zijlstra
2012-03-28 17:38 ` Oleg Nesterov
2012-03-27 21:07 ` [PATCHSET 0/6 version 2] kmod: Optional timeout on the wait in call_usermodehelper_exec Andrew Morton
2012-03-28 20:19 ` Oleg Nesterov
2012-03-28 21:42 ` Boaz Harrosh
2012-03-27 2:02 ` [PATCH 2/6] kmod: Convert two call sites to call_usermodehelper_fns() Boaz Harrosh
2012-03-27 2:04 ` [PATCH 3/6] kmod: Move call_usermodehelper_fns() to .c file and unexport all it's helpers Boaz Harrosh
2012-03-27 2:09 ` [PATCH 4/6 option-B] kmod: add new wait_for_completion_timeout_state() helper Boaz Harrosh
2012-03-27 2:13 ` [PATCH 5/6] kmod: Add new call_usermodehelper_timeout() API Boaz Harrosh
[not found] ` <4F712246.6030201-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2012-03-27 15:43 ` Oleg Nesterov
2012-03-28 17:04 ` Oleg Nesterov
2012-03-27 2:15 ` [PATCH 6/6] kmod: optional: Convert the use of xchg to a kref Boaz Harrosh
2012-03-28 16:35 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332835919.16159.195.camel@twins \
--to=a.p.zijlstra-/nlkjasks4vmr6xm/wnwpw@public.gmane.org \
--cc=Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org \
--cc=kay.sievers-tD+1rO4QERM@public.gmane.org \
--cc=keyrings-6DNke4IJHB0gsBAKwltoeQ@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-X9Un+BFzKDI@public.gmane.org \
--cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=penguin-kernel-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org \
--cc=pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=sbhamare-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org \
--cc=srivatsa.bhat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).