On Thu 06-04-17 12:23:51, NeilBrown wrote: [...] > diff --git a/drivers/block/loop.c b/drivers/block/loop.c > index 0ecb6461ed81..95679d988725 100644 > --- a/drivers/block/loop.c > +++ b/drivers/block/loop.c > @@ -847,10 +847,12 @@ static void loop_unprepare_queue(struct loop_device *lo) > static int loop_prepare_queue(struct loop_device *lo) > { > kthread_init_worker(&lo->worker); > - lo->worker_task = kthread_run(kthread_worker_fn, > + lo->worker_task = kthread_create(kthread_worker_fn, > &lo->worker, "loop%d", lo->lo_number); > if (IS_ERR(lo->worker_task)) > return -ENOMEM; > + lo->worker_task->flags |= PF_LESS_THROTTLE; > + wake_up_process(lo->worker_task); > set_user_nice(lo->worker_task, MIN_NICE); > return 0; This should work for the current implementation because kthread_create will return only after the full initialization has been done. No idea whether we can rely on that in future. I also think it would be cleaner to set the flag on current and keep the current semantic that only current changes its flags. So while I do not have a strong opinion on this I think defining loop specific thread function which set PF_LESS_THROTTLE as the first thing is more elegant and less error prone longerm. A short comment explaining why we use the flag there would be also preferred. I will leave the decision to you. Thanks. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>