bfq-wf2q.c (d7c26e63cf78fef01d66ae848184c6ee5f4b8bbf) bfq-wf2q.c (73d58118498b14e4d2f2391105459b997b586ddc)
1/*
2 * Hierarchical Budget Worst-case Fair Weighted Fair Queueing
3 * (B-WF2Q+): hierarchical scheduling algorithm by which the BFQ I/O
4 * scheduler schedules generic entities. The latter can represent
5 * either single bfq queues (associated with processes) or groups of
6 * bfq queues (associated with cgroups).
7 *
8 * This program is free software; you can redistribute it and/or

--- 30 unchanged lines hidden (view full) ---

39static unsigned int bfq_class_idx(struct bfq_entity *entity)
40{
41 struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
42
43 return bfqq ? bfqq->ioprio_class - 1 :
44 BFQ_DEFAULT_GRP_CLASS - 1;
45}
46
1/*
2 * Hierarchical Budget Worst-case Fair Weighted Fair Queueing
3 * (B-WF2Q+): hierarchical scheduling algorithm by which the BFQ I/O
4 * scheduler schedules generic entities. The latter can represent
5 * either single bfq queues (associated with processes) or groups of
6 * bfq queues (associated with cgroups).
7 *
8 * This program is free software; you can redistribute it and/or

--- 30 unchanged lines hidden (view full) ---

39static unsigned int bfq_class_idx(struct bfq_entity *entity)
40{
41 struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
42
43 return bfqq ? bfqq->ioprio_class - 1 :
44 BFQ_DEFAULT_GRP_CLASS - 1;
45}
46
47unsigned int bfq_tot_busy_queues(struct bfq_data *bfqd)
48{
49 return bfqd->busy_queues[0] + bfqd->busy_queues[1] +
50 bfqd->busy_queues[2];
51}
52
47static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd,
48 bool expiration);
49
50static bool bfq_update_parent_budget(struct bfq_entity *next_in_service);
51
52/**
53 * bfq_update_next_in_service - update sd->next_in_service
54 * @sd: sched_data for which to perform the update.

--- 1453 unchanged lines hidden (view full) ---

1508 * Get next queue for service.
1509 */
1510struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd)
1511{
1512 struct bfq_entity *entity = NULL;
1513 struct bfq_sched_data *sd;
1514 struct bfq_queue *bfqq;
1515
53static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd,
54 bool expiration);
55
56static bool bfq_update_parent_budget(struct bfq_entity *next_in_service);
57
58/**
59 * bfq_update_next_in_service - update sd->next_in_service
60 * @sd: sched_data for which to perform the update.

--- 1453 unchanged lines hidden (view full) ---

1514 * Get next queue for service.
1515 */
1516struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd)
1517{
1518 struct bfq_entity *entity = NULL;
1519 struct bfq_sched_data *sd;
1520 struct bfq_queue *bfqq;
1521
1516 if (bfqd->busy_queues == 0)
1522 if (bfq_tot_busy_queues(bfqd) == 0)
1517 return NULL;
1518
1519 /*
1520 * Traverse the path from the root to the leaf entity to
1521 * serve. Set in service all the entities visited along the
1522 * way.
1523 */
1524 sd = &bfqd->root_group->sched_data;

--- 135 unchanged lines hidden (view full) ---

1660 */
1661void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq,
1662 bool expiration)
1663{
1664 bfq_log_bfqq(bfqd, bfqq, "del from busy");
1665
1666 bfq_clear_bfqq_busy(bfqq);
1667
1523 return NULL;
1524
1525 /*
1526 * Traverse the path from the root to the leaf entity to
1527 * serve. Set in service all the entities visited along the
1528 * way.
1529 */
1530 sd = &bfqd->root_group->sched_data;

--- 135 unchanged lines hidden (view full) ---

1666 */
1667void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq,
1668 bool expiration)
1669{
1670 bfq_log_bfqq(bfqd, bfqq, "del from busy");
1671
1672 bfq_clear_bfqq_busy(bfqq);
1673
1668 bfqd->busy_queues--;
1674 bfqd->busy_queues[bfqq->ioprio_class - 1]--;
1669
1670 if (!bfqq->dispatched)
1671 bfq_weights_tree_remove(bfqd, bfqq);
1672
1673 if (bfqq->wr_coeff > 1)
1674 bfqd->wr_busy_queues--;
1675
1676 bfqg_stats_update_dequeue(bfqq_group(bfqq));

--- 6 unchanged lines hidden (view full) ---

1683 */
1684void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq)
1685{
1686 bfq_log_bfqq(bfqd, bfqq, "add to busy");
1687
1688 bfq_activate_bfqq(bfqd, bfqq);
1689
1690 bfq_mark_bfqq_busy(bfqq);
1675
1676 if (!bfqq->dispatched)
1677 bfq_weights_tree_remove(bfqd, bfqq);
1678
1679 if (bfqq->wr_coeff > 1)
1680 bfqd->wr_busy_queues--;
1681
1682 bfqg_stats_update_dequeue(bfqq_group(bfqq));

--- 6 unchanged lines hidden (view full) ---

1689 */
1690void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq)
1691{
1692 bfq_log_bfqq(bfqd, bfqq, "add to busy");
1693
1694 bfq_activate_bfqq(bfqd, bfqq);
1695
1696 bfq_mark_bfqq_busy(bfqq);
1691 bfqd->busy_queues++;
1697 bfqd->busy_queues[bfqq->ioprio_class - 1]++;
1692
1693 if (!bfqq->dispatched)
1694 if (bfqq->wr_coeff == 1)
1695 bfq_weights_tree_add(bfqd, bfqq,
1696 &bfqd->queue_weights_tree);
1697
1698 if (bfqq->wr_coeff > 1)
1699 bfqd->wr_busy_queues++;
1700}
1698
1699 if (!bfqq->dispatched)
1700 if (bfqq->wr_coeff == 1)
1701 bfq_weights_tree_add(bfqd, bfqq,
1702 &bfqd->queue_weights_tree);
1703
1704 if (bfqq->wr_coeff > 1)
1705 bfqd->wr_busy_queues++;
1706}