Skip to content

Commit

Permalink
dm bufio: remove dm_bufio_cond_resched()
Browse files Browse the repository at this point in the history
Use cond_resched() like everybody else.

Mikulas explained why dm_bufio_cond_resched() was introduced to begin
with (hopefully cond_resched can be improved accordingly) here:
https://www.redhat.com/archives/dm-devel/2016-September/msg00112.html

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Alasdair Kergon <agk@redhat.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Mike Snitzer <snitzer@redhat.com> # added last comment in header
  • Loading branch information
Peter Zijlstra authored and Mike Snitzer committed Sep 22, 2016
1 parent f659b10 commit 7cd3267
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,6 @@ static void dm_bufio_unlock(struct dm_bufio_client *c)
mutex_unlock(&c->lock);
}

/*
* FIXME Move to sched.h?
*/
#ifdef CONFIG_PREEMPT_VOLUNTARY
# define dm_bufio_cond_resched() \
do { \
if (unlikely(need_resched())) \
_cond_resched(); \
} while (0)
#else
# define dm_bufio_cond_resched() do { } while (0)
#endif

/*----------------------------------------------------------------*/

/*
Expand Down Expand Up @@ -741,7 +728,7 @@ static void __flush_write_list(struct list_head *write_list)
list_entry(write_list->next, struct dm_buffer, write_list);
list_del(&b->write_list);
submit_io(b, WRITE, b->block, write_endio);
dm_bufio_cond_resched();
cond_resched();
}
blk_finish_plug(&plug);
}
Expand Down Expand Up @@ -780,7 +767,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c)
__unlink_buffer(b);
return b;
}
dm_bufio_cond_resched();
cond_resched();
}

list_for_each_entry_reverse(b, &c->lru[LIST_DIRTY], lru_list) {
Expand All @@ -791,7 +778,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c)
__unlink_buffer(b);
return b;
}
dm_bufio_cond_resched();
cond_resched();
}

return NULL;
Expand Down Expand Up @@ -923,7 +910,7 @@ static void __write_dirty_buffers_async(struct dm_bufio_client *c, int no_wait,
return;

__write_dirty_buffer(b, write_list);
dm_bufio_cond_resched();
cond_resched();
}
}

Expand Down Expand Up @@ -973,7 +960,7 @@ static void __check_watermark(struct dm_bufio_client *c,
return;

__free_buffer_wake(b);
dm_bufio_cond_resched();
cond_resched();
}

if (c->n_buffers[LIST_DIRTY] > threshold_buffers)
Expand Down Expand Up @@ -1170,7 +1157,7 @@ void dm_bufio_prefetch(struct dm_bufio_client *c,
submit_io(b, READ, b->block, read_endio);
dm_bufio_release(b);

dm_bufio_cond_resched();
cond_resched();

if (!n_blocks)
goto flush_plug;
Expand Down Expand Up @@ -1291,7 +1278,7 @@ int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c)
!test_bit(B_WRITING, &b->state))
__relink_lru(b, LIST_CLEAN);

dm_bufio_cond_resched();
cond_resched();

/*
* If we dropped the lock, the list is no longer consistent,
Expand Down Expand Up @@ -1574,7 +1561,7 @@ static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan,
freed++;
if (!--nr_to_scan || ((count - freed) <= retain_target))
return freed;
dm_bufio_cond_resched();
cond_resched();
}
}
return freed;
Expand Down Expand Up @@ -1808,7 +1795,7 @@ static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz)
if (__try_evict_buffer(b, 0))
count--;

dm_bufio_cond_resched();
cond_resched();
}

dm_bufio_unlock(c);
Expand Down

0 comments on commit 7cd3267

Please sign in to comment.