[Drbd-dev] schedule_timeout() called without setting task state first

David Butterfield dab21774 at gmail.com
Wed Jun 5 17:59:30 CEST 2019


The logic in new_or_recycle_send_buffer_page() calls schedule_timeout() without first setting
the task state.  This will merely yield the processor but not actually wait.  Is that intended?

In drbd_main.c:
968 static void new_or_recycle_send_buffer_page(struct drbd_send_buffer *sbuf)
969 {
970         while (1) {
971                 struct page *page;
972                 int count = page_count(sbuf->page);
973
974                 BUG_ON(count == 0);
975                 if (count == 1)
976                         goto have_page;
977
978                 page = alloc_page(GFP_NOIO | __GFP_NORETRY | __GFP_NOWARN);
979                 if (page) {
980                         put_page(sbuf->page);
981                         sbuf->page = page;
982                         goto have_page;
983                 }
984
985                 //XXX Don't you need to set something like TASK_*INTERRUPTIBLE first?
986                 //XXX I think this just yields the processor but the thread remains runnable(?)
987                 schedule_timeout(HZ / 10);
988         }
989 have_page:
990         sbuf->unsent =
991         sbuf->pos = page_address(sbuf->page);
992 }


More information about the drbd-dev mailing list