License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 17:07:57 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2016-02-19 11:46:37 +03:00
|
|
|
#ifndef _LINUX_SWAIT_H
|
|
|
|
#define _LINUX_SWAIT_H
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
#include <linux/spinlock.h>
|
2018-05-04 13:42:24 +03:00
|
|
|
#include <linux/wait.h>
|
2016-02-19 11:46:37 +03:00
|
|
|
#include <asm/current.h>
|
|
|
|
|
|
|
|
/*
|
swait: strengthen language to discourage use
We already earlier discouraged people from using this interface in
commit 88796e7e5c45 ("sched/swait: Document it clearly that the swait
facilities are special and shouldn't be used"), but I just got a pull
request with a new broken user.
So make the comment *really* clear.
The swait interfaces are bad, and should not be used unless you have
some *very* strong reasons that include tons of hard performance numbers
on just why you want to use them, and you show that you actually
understand that they aren't at all like the normal wait/wakeup
interfaces.
So far, every single user has been suspect. The main user is KVM, which
is completely pointless (there is only ever one waiter, which avoids the
interface subtleties, but also means that having a queue instead of a
pointer is counter-productive and certainly not an "optimization").
So make the comments much stronger.
Not that anybody likely reads them anyway, but there's always some
slight hope that it will cause somebody to think twice.
I'd like to remove this interface entirely, but there is the theoretical
possibility that it's actually the right thing to use in some situation,
most likely some deep RT use.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-06-04 22:01:15 +03:00
|
|
|
* BROKEN wait-queues.
|
|
|
|
*
|
|
|
|
* These "simple" wait-queues are broken garbage, and should never be
|
|
|
|
* used. The comments below claim that they are "similar" to regular
|
|
|
|
* wait-queues, but the semantics are actually completely different, and
|
|
|
|
* every single user we have ever had has been buggy (or pointless).
|
|
|
|
*
|
2018-06-12 11:34:52 +03:00
|
|
|
* A "swake_up_one()" only wakes up _one_ waiter, which is not at all what
|
swait: strengthen language to discourage use
We already earlier discouraged people from using this interface in
commit 88796e7e5c45 ("sched/swait: Document it clearly that the swait
facilities are special and shouldn't be used"), but I just got a pull
request with a new broken user.
So make the comment *really* clear.
The swait interfaces are bad, and should not be used unless you have
some *very* strong reasons that include tons of hard performance numbers
on just why you want to use them, and you show that you actually
understand that they aren't at all like the normal wait/wakeup
interfaces.
So far, every single user has been suspect. The main user is KVM, which
is completely pointless (there is only ever one waiter, which avoids the
interface subtleties, but also means that having a queue instead of a
pointer is counter-productive and certainly not an "optimization").
So make the comments much stronger.
Not that anybody likely reads them anyway, but there's always some
slight hope that it will cause somebody to think twice.
I'd like to remove this interface entirely, but there is the theoretical
possibility that it's actually the right thing to use in some situation,
most likely some deep RT use.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-06-04 22:01:15 +03:00
|
|
|
* "wake_up()" does, and has led to problems. In other cases, it has
|
|
|
|
* been fine, because there's only ever one waiter (kvm), but in that
|
|
|
|
* case gthe whole "simple" wait-queue is just pointless to begin with,
|
|
|
|
* since there is no "queue". Use "wake_up_process()" with a direct
|
|
|
|
* pointer instead.
|
2016-02-19 11:46:37 +03:00
|
|
|
*
|
2017-10-20 20:13:46 +03:00
|
|
|
* While these are very similar to regular wait queues (wait.h) the most
|
|
|
|
* important difference is that the simple waitqueue allows for deterministic
|
|
|
|
* behaviour -- IOW it has strictly bounded IRQ and lock hold times.
|
2016-02-19 11:46:37 +03:00
|
|
|
*
|
2017-10-20 20:13:46 +03:00
|
|
|
* Mainly, this is accomplished by two things. Firstly not allowing swake_up_all
|
|
|
|
* from IRQ disabled, and dropping the lock upon every wakeup, giving a higher
|
|
|
|
* priority task a chance to run.
|
|
|
|
*
|
|
|
|
* Secondly, we had to drop a fair number of features of the other waitqueue
|
|
|
|
* code; notably:
|
2016-02-19 11:46:37 +03:00
|
|
|
*
|
|
|
|
* - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue;
|
|
|
|
* all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right
|
|
|
|
* sleeper state.
|
|
|
|
*
|
2018-06-12 11:34:51 +03:00
|
|
|
* - the !exclusive mode; because that leads to O(n) wakeups, everything is
|
|
|
|
* exclusive.
|
2016-02-19 11:46:37 +03:00
|
|
|
*
|
2017-10-20 20:13:46 +03:00
|
|
|
* - custom wake callback functions; because you cannot give any guarantees
|
|
|
|
* about random code. This also allows swait to be used in RT, such that
|
|
|
|
* raw spinlock can be used for the swait queue head.
|
2016-02-19 11:46:37 +03:00
|
|
|
*
|
2017-10-20 20:13:46 +03:00
|
|
|
* As a side effect of these; the data structures are slimmer albeit more ad-hoc.
|
|
|
|
* For all the above, note that simple wait queues should _only_ be used under
|
|
|
|
* very specific realtime constraints -- it is best to stick with the regular
|
|
|
|
* wait queues in most cases.
|
2016-02-19 11:46:37 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct task_struct;
|
|
|
|
|
|
|
|
struct swait_queue_head {
|
|
|
|
raw_spinlock_t lock;
|
|
|
|
struct list_head task_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct swait_queue {
|
|
|
|
struct task_struct *task;
|
|
|
|
struct list_head task_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define __SWAITQUEUE_INITIALIZER(name) { \
|
|
|
|
.task = current, \
|
|
|
|
.task_list = LIST_HEAD_INIT((name).task_list), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DECLARE_SWAITQUEUE(name) \
|
|
|
|
struct swait_queue name = __SWAITQUEUE_INITIALIZER(name)
|
|
|
|
|
|
|
|
#define __SWAIT_QUEUE_HEAD_INITIALIZER(name) { \
|
|
|
|
.lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \
|
|
|
|
.task_list = LIST_HEAD_INIT((name).task_list), \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DECLARE_SWAIT_QUEUE_HEAD(name) \
|
|
|
|
struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INITIALIZER(name)
|
|
|
|
|
|
|
|
extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name,
|
|
|
|
struct lock_class_key *key);
|
|
|
|
|
|
|
|
#define init_swait_queue_head(q) \
|
|
|
|
do { \
|
|
|
|
static struct lock_class_key __key; \
|
|
|
|
__init_swait_queue_head((q), #q, &__key); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
|
|
# define __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name) \
|
|
|
|
({ init_swait_queue_head(&name); name; })
|
|
|
|
# define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \
|
|
|
|
struct swait_queue_head name = __SWAIT_QUEUE_HEAD_INIT_ONSTACK(name)
|
|
|
|
#else
|
|
|
|
# define DECLARE_SWAIT_QUEUE_HEAD_ONSTACK(name) \
|
|
|
|
DECLARE_SWAIT_QUEUE_HEAD(name)
|
|
|
|
#endif
|
|
|
|
|
2017-09-13 23:08:18 +03:00
|
|
|
/**
|
|
|
|
* swait_active -- locklessly test for waiters on the queue
|
|
|
|
* @wq: the waitqueue to test for waiters
|
|
|
|
*
|
|
|
|
* returns true if the wait list is not empty
|
|
|
|
*
|
|
|
|
* NOTE: this function is lockless and requires care, incorrect usage _will_
|
|
|
|
* lead to sporadic and non-obvious failure.
|
|
|
|
*
|
|
|
|
* NOTE2: this function has the same above implications as regular waitqueues.
|
|
|
|
*
|
|
|
|
* Use either while holding swait_queue_head::lock or when used for wakeups
|
|
|
|
* with an extra smp_mb() like:
|
|
|
|
*
|
|
|
|
* CPU0 - waker CPU1 - waiter
|
|
|
|
*
|
|
|
|
* for (;;) {
|
2018-06-12 11:34:52 +03:00
|
|
|
* @cond = true; prepare_to_swait_exclusive(&wq_head, &wait, state);
|
2017-09-13 23:08:18 +03:00
|
|
|
* smp_mb(); // smp_mb() from set_current_state()
|
|
|
|
* if (swait_active(wq_head)) if (@cond)
|
|
|
|
* wake_up(wq_head); break;
|
|
|
|
* schedule();
|
|
|
|
* }
|
|
|
|
* finish_swait(&wq_head, &wait);
|
|
|
|
*
|
|
|
|
* Because without the explicit smp_mb() it's possible for the
|
|
|
|
* swait_active() load to get hoisted over the @cond store such that we'll
|
|
|
|
* observe an empty wait list while the waiter might not observe @cond.
|
|
|
|
* This, in turn, can trigger missing wakeups.
|
|
|
|
*
|
|
|
|
* Also note that this 'optimization' trades a spin_lock() for an smp_mb(),
|
|
|
|
* which (when the lock is uncontended) are of roughly equal cost.
|
|
|
|
*/
|
|
|
|
static inline int swait_active(struct swait_queue_head *wq)
|
|
|
|
{
|
|
|
|
return !list_empty(&wq->task_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* swq_has_sleeper - check if there are any waiting processes
|
|
|
|
* @wq: the waitqueue to test for waiters
|
|
|
|
*
|
|
|
|
* Returns true if @wq has waiting processes
|
|
|
|
*
|
|
|
|
* Please refer to the comment for swait_active.
|
|
|
|
*/
|
|
|
|
static inline bool swq_has_sleeper(struct swait_queue_head *wq)
|
2016-02-19 11:46:37 +03:00
|
|
|
{
|
2017-09-13 23:08:18 +03:00
|
|
|
/*
|
|
|
|
* We need to be sure we are in sync with the list_add()
|
|
|
|
* modifications to the wait queue (task_list).
|
|
|
|
*
|
|
|
|
* This memory barrier should be paired with one on the
|
|
|
|
* waiting side.
|
|
|
|
*/
|
|
|
|
smp_mb();
|
|
|
|
return swait_active(wq);
|
2016-02-19 11:46:37 +03:00
|
|
|
}
|
|
|
|
|
2018-06-12 11:34:52 +03:00
|
|
|
extern void swake_up_one(struct swait_queue_head *q);
|
2016-02-19 11:46:37 +03:00
|
|
|
extern void swake_up_all(struct swait_queue_head *q);
|
|
|
|
extern void swake_up_locked(struct swait_queue_head *q);
|
|
|
|
|
2018-06-12 11:34:52 +03:00
|
|
|
extern void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *wait, int state);
|
2016-02-19 11:46:37 +03:00
|
|
|
extern long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state);
|
|
|
|
|
|
|
|
extern void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait);
|
|
|
|
extern void finish_swait(struct swait_queue_head *q, struct swait_queue *wait);
|
|
|
|
|
2018-06-12 11:34:51 +03:00
|
|
|
/* as per ___wait_event() but for swait, therefore "exclusive == 1" */
|
2016-02-19 11:46:37 +03:00
|
|
|
#define ___swait_event(wq, condition, state, ret, cmd) \
|
|
|
|
({ \
|
2018-06-12 11:34:51 +03:00
|
|
|
__label__ __out; \
|
2016-02-19 11:46:37 +03:00
|
|
|
struct swait_queue __wait; \
|
|
|
|
long __ret = ret; \
|
|
|
|
\
|
|
|
|
INIT_LIST_HEAD(&__wait.task_list); \
|
|
|
|
for (;;) { \
|
|
|
|
long __int = prepare_to_swait_event(&wq, &__wait, state);\
|
|
|
|
\
|
|
|
|
if (condition) \
|
|
|
|
break; \
|
|
|
|
\
|
|
|
|
if (___wait_is_interruptible(state) && __int) { \
|
|
|
|
__ret = __int; \
|
2018-06-12 11:34:51 +03:00
|
|
|
goto __out; \
|
2016-02-19 11:46:37 +03:00
|
|
|
} \
|
|
|
|
\
|
|
|
|
cmd; \
|
|
|
|
} \
|
|
|
|
finish_swait(&wq, &__wait); \
|
2018-06-12 11:34:51 +03:00
|
|
|
__out: __ret; \
|
2016-02-19 11:46:37 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
#define __swait_event(wq, condition) \
|
|
|
|
(void)___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \
|
|
|
|
schedule())
|
|
|
|
|
2018-06-12 11:34:52 +03:00
|
|
|
#define swait_event_exclusive(wq, condition) \
|
2016-02-19 11:46:37 +03:00
|
|
|
do { \
|
|
|
|
if (condition) \
|
|
|
|
break; \
|
|
|
|
__swait_event(wq, condition); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define __swait_event_timeout(wq, condition, timeout) \
|
|
|
|
___swait_event(wq, ___wait_cond_timeout(condition), \
|
|
|
|
TASK_UNINTERRUPTIBLE, timeout, \
|
|
|
|
__ret = schedule_timeout(__ret))
|
|
|
|
|
2018-06-12 11:34:52 +03:00
|
|
|
#define swait_event_timeout_exclusive(wq, condition, timeout) \
|
2016-02-19 11:46:37 +03:00
|
|
|
({ \
|
|
|
|
long __ret = timeout; \
|
|
|
|
if (!___wait_cond_timeout(condition)) \
|
|
|
|
__ret = __swait_event_timeout(wq, condition, timeout); \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define __swait_event_interruptible(wq, condition) \
|
|
|
|
___swait_event(wq, condition, TASK_INTERRUPTIBLE, 0, \
|
|
|
|
schedule())
|
|
|
|
|
2018-06-12 11:34:52 +03:00
|
|
|
#define swait_event_interruptible_exclusive(wq, condition) \
|
2016-02-19 11:46:37 +03:00
|
|
|
({ \
|
|
|
|
int __ret = 0; \
|
|
|
|
if (!(condition)) \
|
|
|
|
__ret = __swait_event_interruptible(wq, condition); \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
|
|
|
#define __swait_event_interruptible_timeout(wq, condition, timeout) \
|
|
|
|
___swait_event(wq, ___wait_cond_timeout(condition), \
|
|
|
|
TASK_INTERRUPTIBLE, timeout, \
|
|
|
|
__ret = schedule_timeout(__ret))
|
|
|
|
|
2018-06-12 11:34:52 +03:00
|
|
|
#define swait_event_interruptible_timeout_exclusive(wq, condition, timeout)\
|
2016-02-19 11:46:37 +03:00
|
|
|
({ \
|
|
|
|
long __ret = timeout; \
|
|
|
|
if (!___wait_cond_timeout(condition)) \
|
|
|
|
__ret = __swait_event_interruptible_timeout(wq, \
|
|
|
|
condition, timeout); \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
2017-06-21 00:45:46 +03:00
|
|
|
#define __swait_event_idle(wq, condition) \
|
|
|
|
(void)___swait_event(wq, condition, TASK_IDLE, 0, schedule())
|
|
|
|
|
|
|
|
/**
|
2018-06-12 11:34:52 +03:00
|
|
|
* swait_event_idle_exclusive - wait without system load contribution
|
2017-06-21 00:45:46 +03:00
|
|
|
* @wq: the waitqueue to wait on
|
|
|
|
* @condition: a C expression for the event to wait for
|
|
|
|
*
|
|
|
|
* The process is put to sleep (TASK_IDLE) until the @condition evaluates to
|
|
|
|
* true. The @condition is checked each time the waitqueue @wq is woken up.
|
|
|
|
*
|
|
|
|
* This function is mostly used when a kthread or workqueue waits for some
|
|
|
|
* condition and doesn't want to contribute to system load. Signals are
|
|
|
|
* ignored.
|
|
|
|
*/
|
2018-06-12 11:34:52 +03:00
|
|
|
#define swait_event_idle_exclusive(wq, condition) \
|
2017-06-21 00:45:46 +03:00
|
|
|
do { \
|
|
|
|
if (condition) \
|
|
|
|
break; \
|
|
|
|
__swait_event_idle(wq, condition); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define __swait_event_idle_timeout(wq, condition, timeout) \
|
|
|
|
___swait_event(wq, ___wait_cond_timeout(condition), \
|
|
|
|
TASK_IDLE, timeout, \
|
|
|
|
__ret = schedule_timeout(__ret))
|
|
|
|
|
|
|
|
/**
|
2018-06-12 11:34:52 +03:00
|
|
|
* swait_event_idle_timeout_exclusive - wait up to timeout without load contribution
|
2017-06-21 00:45:46 +03:00
|
|
|
* @wq: the waitqueue to wait on
|
|
|
|
* @condition: a C expression for the event to wait for
|
|
|
|
* @timeout: timeout at which we'll give up in jiffies
|
|
|
|
*
|
|
|
|
* The process is put to sleep (TASK_IDLE) until the @condition evaluates to
|
|
|
|
* true. The @condition is checked each time the waitqueue @wq is woken up.
|
|
|
|
*
|
|
|
|
* This function is mostly used when a kthread or workqueue waits for some
|
|
|
|
* condition and doesn't want to contribute to system load. Signals are
|
|
|
|
* ignored.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* 0 if the @condition evaluated to %false after the @timeout elapsed,
|
|
|
|
* 1 if the @condition evaluated to %true after the @timeout elapsed,
|
|
|
|
* or the remaining jiffies (at least 1) if the @condition evaluated
|
|
|
|
* to %true before the @timeout elapsed.
|
|
|
|
*/
|
2018-06-12 11:34:52 +03:00
|
|
|
#define swait_event_idle_timeout_exclusive(wq, condition, timeout) \
|
2017-06-21 00:45:46 +03:00
|
|
|
({ \
|
|
|
|
long __ret = timeout; \
|
|
|
|
if (!___wait_cond_timeout(condition)) \
|
|
|
|
__ret = __swait_event_idle_timeout(wq, \
|
|
|
|
condition, timeout); \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
2016-02-19 11:46:37 +03:00
|
|
|
#endif /* _LINUX_SWAIT_H */
|