From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756305AbcJTVJw (ORCPT ); Thu, 20 Oct 2016 17:09:52 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:49696 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755790AbcJTVJv (ORCPT ); Thu, 20 Oct 2016 17:09:51 -0400 Date: Thu, 20 Oct 2016 23:06:48 +0200 (CEST) From: Thomas Gleixner To: Douglas Anderson cc: John Stultz , Andreas Mohr , briannorris@chromium.org, huangtao@rock-chips.com, tony.xie@rock-chips.com, linux-rockchip@lists.infradead.org, linux@roeck-us.net, heiko@sntech.de, broonie@kernel.org, djkurtz@chromium.org, tskd08@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] timers: Fix documentation for schedule_timeout() and similar In-Reply-To: <1476995664-15668-2-git-send-email-dianders@chromium.org> Message-ID: References: <1476995664-15668-1-git-send-email-dianders@chromium.org> <1476995664-15668-2-git-send-email-dianders@chromium.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Oct 2016, Douglas Anderson wrote: > +++ b/kernel/time/hrtimer.c > @@ -1742,15 +1742,19 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta, > * You can set the task state as follows - > * > * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to > - * pass before the routine returns. > + * pass before the routine returns unless the current task is explicitly > + * woken up, (e.g. by wake_up_process())". The double quote is stray. > * > * %TASK_INTERRUPTIBLE - the routine may return early if a signal is > - * delivered to the current task. > + * delivered to the current task or the current task is explicitly woken > + * up. > * > * The current task state is guaranteed to be TASK_RUNNING when this > * routine returns. > * > - * Returns 0 when the timer has expired otherwise -EINTR > + * Returns 0 when the timer has expired otherwise -EINTR. Note that > + * -EINTR can still be returned even if the task state is > + * TASK_UNINTERRUPTIBLE if the current task is explicitly woken up. I'd prefer to word it this way: Returns 0 when the timer has expired. If the task was woken before the timer expired by a signal (only possible in state TASK_INTERRUPTIBLE) or by an explicit wakeup, it returns -EINTR. > */ > int __sched schedule_hrtimeout_range(ktime_t *expires, u64 delta, > const enum hrtimer_mode mode) > @@ -1772,15 +1776,19 @@ EXPORT_SYMBOL_GPL(schedule_hrtimeout_range); > * You can set the task state as follows - > * > * %TASK_UNINTERRUPTIBLE - at least @timeout time is guaranteed to > - * pass before the routine returns. > + * pass before the routine returns unless the current task is explicitly > + * woken up, (e.g. by wake_up_process())". See above > * > * %TASK_INTERRUPTIBLE - the routine may return early if a signal is > - * delivered to the current task. > + * delivered to the current task or the current task is explicitly woken > + * up. > * > * The current task state is guaranteed to be TASK_RUNNING when this > * routine returns. > * > - * Returns 0 when the timer has expired otherwise -EINTR > + * Returns 0 when the timer has expired otherwise -EINTR. Note that > + * -EINTR can still be returned even if the task state is > + * TASK_UNINTERRUPTIBLE if the current task is explicitly woken up. See above > @@ -1691,11 +1691,12 @@ static void process_timeout(unsigned long __data) > * You can set the task state as follows - > * > * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to > - * pass before the routine returns. The routine will return 0 > + * pass before the routine returns unless the current task is explicitly > + * woken up, (e.g. by wake_up_process())". > * > * %TASK_INTERRUPTIBLE - the routine may return early if a signal is > - * delivered to the current task. In this case the remaining time > - * in jiffies will be returned, or 0 if the timer expired in time > + * delivered to the current task or the current task is explicitly woken > + * up. > * > * The current task state is guaranteed to be TASK_RUNNING when this > * routine returns. > @@ -1704,7 +1705,9 @@ static void process_timeout(unsigned long __data) > * the CPU away without a bound on the timeout. In this case the return > * value will be %MAX_SCHEDULE_TIMEOUT. > * > - * In all cases the return value is guaranteed to be non-negative. > + * Returns 0 when the timer has expired otherwise the remaining time in > + * jiffies will be returned. In all cases the return value is guaranteed > + * to be non-negative. That one is fine. Thanks, tglx