All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen: credit2: document that min_rqd is valid and ok to use
@ 2020-03-26 17:08 Dario Faggioli
  2020-07-22 15:40 ` Dario Faggioli
  2020-10-26 10:43 ` [Xen-devel] " George Dunlap
  0 siblings, 2 replies; 4+ messages in thread
From: Dario Faggioli @ 2020-03-26 17:08 UTC (permalink / raw)
  To: xen-devel; +Cc: JürgenGroß, Jan Beulich

Code is a bit involved, and it is not easy to tell that min_rqd, inside
csched2_res_pick() is actually pointing to a runqueue, when it is
dereferenced.

Add a comment and an ASSERT() for that.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
Cc: Jürgen Groß <jgross@suse.com>
---
 xen/common/sched/credit2.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index c7241944a8..9da51e624b 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -2387,6 +2387,13 @@ csched2_res_pick(const struct scheduler *ops, const struct sched_unit *unit)
         goto out_up;
     }
 
+    /*
+     * If we're here, min_rqd must be valid. In fact, either we picked a
+     * runqueue in the "list_for_each" (as min_avgload is initialized to
+     * MAX_LOAD) or we just did that (in the "else" branch) above.
+     */
+    ASSERT(min_rqd);
+
     new_cpu = cpumask_cycle(min_rqd->pick_bias, cpumask_scratch_cpu(cpu));
     min_rqd->pick_bias = new_cpu;
     BUG_ON(new_cpu >= nr_cpu_ids);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-26 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 17:08 [Xen-devel] [PATCH] xen: credit2: document that min_rqd is valid and ok to use Dario Faggioli
2020-07-22 15:40 ` Dario Faggioli
2020-10-26 10:43 ` [Xen-devel] " George Dunlap
2020-10-26 17:44   ` Dario Faggioli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.