函数源码 |
Source File:block\bfq-wf2q.c |
Create Date:2022-07-27 19:35:26 |
首页 | Copyright©Brick |
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | static void bfq_update_fin_time_enqueue( struct bfq_entity *entity, struct bfq_service_tree *st, bool backshifted) { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); /* * When this function is invoked, entity is not in any service * tree, then it is safe to invoke next function with the last * parameter set (see the comments on the function). */ st = __bfq_entity_update_weight_prio(st, entity, true ); bfq_calc_finish(entity, entity->budget); /* * If some queues enjoy backshifting for a while, then their * (virtual) finish timestamps may happen to become lower and * lower than the system virtual time. In particular, if * these queues often happen to be idle for short time * periods, and during such time periods other queues with * higher timestamps happen to be busy, then the backshifted * timestamps of the former queues can become much lower than * the system virtual time. In fact, to serve the queues with * higher timestamps while the ones with lower timestamps are * idle, the system virtual time may be pushed-up to much * higher values than the finish timestamps of the idle * queues. As a consequence, the finish timestamps of all new * or newly activated queues may end up being much larger than * those of lucky queues with backshifted timestamps. The * latter queues may then monopolize the device for a lot of * time. This would simply break service guarantees. * * To reduce this problem, push up a little bit the * backshifted timestamps of the queue associated with this * entity (only a queue can happen to have the backshifted * flag set): just enough to let the finish timestamp of the * queue be equal to the current value of the system virtual * time. This may introduce a little unfairness among queues * with backshifted timestamps, but it does not break * worst-case fairness guarantees. * * As a special case, if bfqq is weight-raised, push up * timestamps much less, to keep very low the probability that * this push up causes the backshifted finish timestamps of * weight-raised queues to become higher than the backshifted * finish timestamps of non weight-raised queues. */ if (backshifted && bfq_gt(st->vtime, entity->finish)) { unsigned long delta = st->vtime - entity->finish; if (bfqq) delta /= bfqq->wr_coeff; entity->start += delta; entity->finish += delta; } bfq_active_insert(st, entity); } |