Skip to content

Commit 7cd3267

Browse files
Peter Zijlstrasnitm
Peter Zijlstra
authored andcommitted
dm bufio: remove dm_bufio_cond_resched()
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 <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: Mike Snitzer <[email protected]> Cc: Alasdair Kergon <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> # added last comment in header
1 parent f659b10 commit 7cd3267

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

drivers/md/dm-bufio.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,6 @@ static void dm_bufio_unlock(struct dm_bufio_client *c)
191191
mutex_unlock(&c->lock);
192192
}
193193

194-
/*
195-
* FIXME Move to sched.h?
196-
*/
197-
#ifdef CONFIG_PREEMPT_VOLUNTARY
198-
# define dm_bufio_cond_resched() \
199-
do { \
200-
if (unlikely(need_resched())) \
201-
_cond_resched(); \
202-
} while (0)
203-
#else
204-
# define dm_bufio_cond_resched() do { } while (0)
205-
#endif
206-
207194
/*----------------------------------------------------------------*/
208195

209196
/*
@@ -741,7 +728,7 @@ static void __flush_write_list(struct list_head *write_list)
741728
list_entry(write_list->next, struct dm_buffer, write_list);
742729
list_del(&b->write_list);
743730
submit_io(b, WRITE, b->block, write_endio);
744-
dm_bufio_cond_resched();
731+
cond_resched();
745732
}
746733
blk_finish_plug(&plug);
747734
}
@@ -780,7 +767,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c)
780767
__unlink_buffer(b);
781768
return b;
782769
}
783-
dm_bufio_cond_resched();
770+
cond_resched();
784771
}
785772

786773
list_for_each_entry_reverse(b, &c->lru[LIST_DIRTY], lru_list) {
@@ -791,7 +778,7 @@ static struct dm_buffer *__get_unclaimed_buffer(struct dm_bufio_client *c)
791778
__unlink_buffer(b);
792779
return b;
793780
}
794-
dm_bufio_cond_resched();
781+
cond_resched();
795782
}
796783

797784
return NULL;
@@ -923,7 +910,7 @@ static void __write_dirty_buffers_async(struct dm_bufio_client *c, int no_wait,
923910
return;
924911

925912
__write_dirty_buffer(b, write_list);
926-
dm_bufio_cond_resched();
913+
cond_resched();
927914
}
928915
}
929916

@@ -973,7 +960,7 @@ static void __check_watermark(struct dm_bufio_client *c,
973960
return;
974961

975962
__free_buffer_wake(b);
976-
dm_bufio_cond_resched();
963+
cond_resched();
977964
}
978965

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

1173-
dm_bufio_cond_resched();
1160+
cond_resched();
11741161

11751162
if (!n_blocks)
11761163
goto flush_plug;
@@ -1291,7 +1278,7 @@ int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c)
12911278
!test_bit(B_WRITING, &b->state))
12921279
__relink_lru(b, LIST_CLEAN);
12931280

1294-
dm_bufio_cond_resched();
1281+
cond_resched();
12951282

12961283
/*
12971284
* If we dropped the lock, the list is no longer consistent,
@@ -1574,7 +1561,7 @@ static unsigned long __scan(struct dm_bufio_client *c, unsigned long nr_to_scan,
15741561
freed++;
15751562
if (!--nr_to_scan || ((count - freed) <= retain_target))
15761563
return freed;
1577-
dm_bufio_cond_resched();
1564+
cond_resched();
15781565
}
15791566
}
15801567
return freed;
@@ -1808,7 +1795,7 @@ static void __evict_old_buffers(struct dm_bufio_client *c, unsigned long age_hz)
18081795
if (__try_evict_buffer(b, 0))
18091796
count--;
18101797

1811-
dm_bufio_cond_resched();
1798+
cond_resched();
18121799
}
18131800

18141801
dm_bufio_unlock(c);

0 commit comments

Comments
 (0)