Merge tag 'vfs-5.4-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-2.6-microblaze.git] / block / bfq-wf2q.c
index ae4d000..05f0bf4 100644 (file)
@@ -1,19 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Hierarchical Budget Worst-case Fair Weighted Fair Queueing
  * (B-WF2Q+): hierarchical scheduling algorithm by which the BFQ I/O
  * scheduler schedules generic entities. The latter can represent
  * either single bfq queues (associated with processes) or groups of
  * bfq queues (associated with cgroups).
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License as
- *  published by the Free Software Foundation; either version 2 of the
- *  License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
  */
 #include "bfq-iosched.h"
 
@@ -59,7 +50,7 @@ static bool bfq_update_parent_budget(struct bfq_entity *next_in_service);
  * bfq_update_next_in_service - update sd->next_in_service
  * @sd: sched_data for which to perform the update.
  * @new_entity: if not NULL, pointer to the entity whose activation,
- *             requeueing or repositionig triggered the invocation of
+ *             requeueing or repositioning triggered the invocation of
  *             this function.
  * @expiration: id true, this function is being invoked after the
  *             expiration of the in-service entity
@@ -90,7 +81,7 @@ static bool bfq_update_next_in_service(struct bfq_sched_data *sd,
 
        /*
         * If this update is triggered by the activation, requeueing
-        * or repositiong of an entity that does not coincide with
+        * or repositioning of an entity that does not coincide with
         * sd->next_in_service, then a full lookup in the active tree
         * can be avoided. In fact, it is enough to check whether the
         * just-modified entity has the same priority as
@@ -737,7 +728,7 @@ __bfq_entity_update_weight_prio(struct bfq_service_tree *old_st,
                struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
                unsigned int prev_weight, new_weight;
                struct bfq_data *bfqd = NULL;
-               struct rb_root *root;
+               struct rb_root_cached *root;
 #ifdef CONFIG_BFQ_GROUP_IOSCHED
                struct bfq_sched_data *sd;
                struct bfq_group *bfqg;
@@ -753,6 +744,8 @@ __bfq_entity_update_weight_prio(struct bfq_service_tree *old_st,
                }
 #endif
 
+               /* Matches the smp_wmb() in bfq_group_set_weight. */
+               smp_rmb();
                old_st->wsum -= entity->weight;
 
                if (entity->new_weight != entity->orig_weight) {
@@ -1396,7 +1389,7 @@ left:
  * In this first case, update the virtual time in @st too (see the
  * comments on this update inside the function).
  *
- * In constrast, if there is an in-service entity, then return the
+ * In contrast, if there is an in-service entity, then return the
  * entity that would be set in service if not only the above
  * conditions, but also the next one held true: the currently
  * in-service entity, on expiration,
@@ -1479,12 +1472,12 @@ static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd,
                 * is being invoked as a part of the expiration path
                 * of the in-service queue. In this case, even if
                 * sd->in_service_entity is not NULL,
-                * sd->in_service_entiy at this point is actually not
+                * sd->in_service_entity at this point is actually not
                 * in service any more, and, if needed, has already
                 * been properly queued or requeued into the right
                 * tree. The reason why sd->in_service_entity is still
                 * not NULL here, even if expiration is true, is that
-                * sd->in_service_entiy is reset as a last step in the
+                * sd->in_service_entity is reset as a last step in the
                 * expiration path. So, if expiration is true, tell
                 * __bfq_lookup_next_entity that there is no
                 * sd->in_service_entity.