static int bfq_update_next_active(struct bfq_sched_data *sd) { struct bfq_group *bfqg; struct bfq_entity *entity, *next_active; if (sd->active_entity != NULL) /* will update/requeue at the end of service */ return 0; /* * NOTE: this can be improved in many ways, such as returning * 1 (and thus propagating upwards the update) only when the * budget changes, or caching the bfqq that will be scheduled * next from this subtree. By now we worry more about * correctness than about performance... */ next_active = bfq_lookup_next_entity(sd, 0); sd->next_active = next_active; if (next_active != NULL) { bfqg = container_of(sd, struct bfq_group, sched_data); entity = bfqg->my_entity; if (entity != NULL) entity->budget = next_active->budget; }
static int bfq_update_next_in_service(struct bfq_sched_data *sd) { struct bfq_entity *next_in_service; if (sd->in_service_entity != NULL) /* will update/requeue at the end of service */ return 0; /* * NOTE: this can be improved in many ways, such as returning * 1 (and thus propagating upwards the update) only when the * budget changes, or caching the bfqq that will be scheduled * next from this subtree. By now we worry more about * correctness than about performance... */ next_in_service = bfq_lookup_next_entity(sd, 0, NULL); sd->next_in_service = next_in_service; if (next_in_service != NULL) bfq_update_budget(next_in_service); return 1; }