diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-01-19 03:26:37 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-01-23 15:17:18 -0500 |
commit | 6f6b5d1ec56acdeab0503d2b823f6f88a0af493e (patch) | |
tree | 7a95dca01cc9ddd652ccbfba4df9d5c30abda549 /include | |
parent | 4a4caa29f1abcb14377e05d57c0793d338fb945d (diff) |
percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask
This patch changes percpu_ida_alloc() + callers to accept task state
bitmask for prepare_to_wait() for code like target/iscsi that needs
it for interruptible sleep, that is provided in a subsequent patch.
It now expects TASK_UNINTERRUPTIBLE when the caller is able to sleep
waiting for a new tag, or TASK_RUNNING when the caller cannot sleep,
and is forced to return a negative value when no tags are available.
v2 changes:
- Include blk-mq + tcm_fc + vhost/scsi + target/iscsi changes
- Drop signal_pending_state() call
v3 changes:
- Only call prepare_to_wait() + finish_wait() when != TASK_RUNNING
(PeterZ)
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: <stable@vger.kernel.org> #3.12+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/percpu_ida.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h index 1900bd0fa639..f5cfdd6a5539 100644 --- a/include/linux/percpu_ida.h +++ b/include/linux/percpu_ida.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/bitops.h> | 5 | #include <linux/bitops.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/sched.h> | ||
7 | #include <linux/spinlock_types.h> | 8 | #include <linux/spinlock_types.h> |
8 | #include <linux/wait.h> | 9 | #include <linux/wait.h> |
9 | #include <linux/cpumask.h> | 10 | #include <linux/cpumask.h> |
@@ -61,7 +62,7 @@ struct percpu_ida { | |||
61 | /* Max size of percpu freelist, */ | 62 | /* Max size of percpu freelist, */ |
62 | #define IDA_DEFAULT_PCPU_SIZE ((IDA_DEFAULT_PCPU_BATCH_MOVE * 3) / 2) | 63 | #define IDA_DEFAULT_PCPU_SIZE ((IDA_DEFAULT_PCPU_BATCH_MOVE * 3) / 2) |
63 | 64 | ||
64 | int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp); | 65 | int percpu_ida_alloc(struct percpu_ida *pool, int state); |
65 | void percpu_ida_free(struct percpu_ida *pool, unsigned tag); | 66 | void percpu_ida_free(struct percpu_ida *pool, unsigned tag); |
66 | 67 | ||
67 | void percpu_ida_destroy(struct percpu_ida *pool); | 68 | void percpu_ida_destroy(struct percpu_ida *pool); |