diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-06-20 06:06:46 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-06-20 06:19:14 -0400 |
commit | 2055da97389a605c8a00d163d40903afbe413921 (patch) | |
tree | 6aec7243076aab2d4d239f03e34598752ce1512a /block/kyber-iosched.c | |
parent | 5822a454d6d22297c5fcd66264120587b2ec21cd (diff) |
sched/wait: Disambiguate wq_entry->task_list and wq_head->task_list naming
So I've noticed a number of instances where it was not obvious from the
code whether ->task_list was for a wait-queue head or a wait-queue entry.
Furthermore, there's a number of wait-queue users where the lists are
not for 'tasks' but other entities (poll tables, etc.), in which case
the 'task_list' name is actively confusing.
To clear this all up, name the wait-queue head and entry list structure
fields unambiguously:
struct wait_queue_head::task_list => ::head
struct wait_queue_entry::task_list => ::entry
For example, this code:
rqw->wait.task_list.next != &wait->task_list
... is was pretty unclear (to me) what it's doing, while now it's written this way:
rqw->wait.head.next != &wait->entry
... which makes it pretty clear that we are iterating a list until we see the head.
Other examples are:
list_for_each_entry_safe(pos, next, &x->task_list, task_list) {
list_for_each_entry(wq, &fence->wait.task_list, task_list) {
... where it's unclear (to me) what we are iterating, and during review it's
hard to tell whether it's trying to walk a wait-queue entry (which would be
a bug), while now it's written as:
list_for_each_entry_safe(pos, next, &x->head, entry) {
list_for_each_entry(wq, &fence->wait.head, entry) {
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'block/kyber-iosched.c')
-rw-r--r-- | block/kyber-iosched.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c index b95d6bd714c0..9bf1484365b2 100644 --- a/block/kyber-iosched.c +++ b/block/kyber-iosched.c | |||
@@ -385,7 +385,7 @@ static int kyber_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int hctx_idx) | |||
385 | 385 | ||
386 | for (i = 0; i < KYBER_NUM_DOMAINS; i++) { | 386 | for (i = 0; i < KYBER_NUM_DOMAINS; i++) { |
387 | INIT_LIST_HEAD(&khd->rqs[i]); | 387 | INIT_LIST_HEAD(&khd->rqs[i]); |
388 | INIT_LIST_HEAD(&khd->domain_wait[i].task_list); | 388 | INIT_LIST_HEAD(&khd->domain_wait[i].entry); |
389 | atomic_set(&khd->wait_index[i], 0); | 389 | atomic_set(&khd->wait_index[i], 0); |
390 | } | 390 | } |
391 | 391 | ||
@@ -512,7 +512,7 @@ static int kyber_domain_wake(wait_queue_entry_t *wait, unsigned mode, int flags, | |||
512 | { | 512 | { |
513 | struct blk_mq_hw_ctx *hctx = READ_ONCE(wait->private); | 513 | struct blk_mq_hw_ctx *hctx = READ_ONCE(wait->private); |
514 | 514 | ||
515 | list_del_init(&wait->task_list); | 515 | list_del_init(&wait->entry); |
516 | blk_mq_run_hw_queue(hctx, true); | 516 | blk_mq_run_hw_queue(hctx, true); |
517 | return 1; | 517 | return 1; |
518 | } | 518 | } |
@@ -536,7 +536,7 @@ static int kyber_get_domain_token(struct kyber_queue_data *kqd, | |||
536 | * run when one becomes available. Note that this is serialized on | 536 | * run when one becomes available. Note that this is serialized on |
537 | * khd->lock, but we still need to be careful about the waker. | 537 | * khd->lock, but we still need to be careful about the waker. |
538 | */ | 538 | */ |
539 | if (list_empty_careful(&wait->task_list)) { | 539 | if (list_empty_careful(&wait->entry)) { |
540 | init_waitqueue_func_entry(wait, kyber_domain_wake); | 540 | init_waitqueue_func_entry(wait, kyber_domain_wake); |
541 | wait->private = hctx; | 541 | wait->private = hctx; |
542 | ws = sbq_wait_ptr(domain_tokens, | 542 | ws = sbq_wait_ptr(domain_tokens, |
@@ -736,7 +736,7 @@ static int kyber_##name##_waiting_show(void *data, struct seq_file *m) \ | |||
736 | struct kyber_hctx_data *khd = hctx->sched_data; \ | 736 | struct kyber_hctx_data *khd = hctx->sched_data; \ |
737 | wait_queue_entry_t *wait = &khd->domain_wait[domain]; \ | 737 | wait_queue_entry_t *wait = &khd->domain_wait[domain]; \ |
738 | \ | 738 | \ |
739 | seq_printf(m, "%d\n", !list_empty_careful(&wait->task_list)); \ | 739 | seq_printf(m, "%d\n", !list_empty_careful(&wait->entry)); \ |
740 | return 0; \ | 740 | return 0; \ |
741 | } | 741 | } |
742 | KYBER_DEBUGFS_DOMAIN_ATTRS(KYBER_READ, read) | 742 | KYBER_DEBUGFS_DOMAIN_ATTRS(KYBER_READ, read) |