Skip to contentSkip to conversation

schedule_timeout() called without setting task state first

Drbd-dev David Butterfield 2 participants 2 messages Jun 5, 2019 – Jun 12, 2019 DRBD driver

lore
Share & tools
lore
#0 lore raw

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 }

maintainer
#1 lore raw
Quoted 16 lines · David Butterfield

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) {

Quoted 8 lines
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);

was likely meant to be a schedule_timeout_uninterruptible(), yes. Frequent typo, unfortunately.

Lars