John L Griffin
2006-Jan-05 19:26 UTC
[Xen-devel] [PATCH] Getting and setting SEDF scheduling parameters
This patch addresses three problems in the function sedf_adjdom(): 1) Setting certain values during the DOM0_ADJUSTDOM hypercall causes an immediate system lockup. Specifically, the lockup occurs during a SCHED_INFO_PUT operation if the user-specified value for period is nonzero, extratime is 1, and weight is zero. (If you''d like my test code to verify this, mail me off-list.) The attached patch tests for the invalid combination of (extratime == 1) && (weight == 0), and returns -EINVAL if encountered. 2) During the SCHED_SEDF / SCHED_INFO_GET hypercall, an incorrect value is returned for weight when (extratime == 1). The attached patch fixes this problem. 3) The code logic in this function is cryptic, and there is not much documentation on how the scheduling parameters should be used. The attached patch adds comments to the sedf_adjdom() function, and reorders/rewrites the logic of the SCHED_INFO_PUT handling to make the code more self-documenting. Note that this patch makes strong assumptions about how the scheduling parameters are used. So, I recommend someone take a really close look at my comments to make sure I''ve preserved the Xen team''s intentions for how the SEDF scheduler works. :-) Signed-off-by: jlg@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Jan-06 10:37 UTC
Re: [Xen-devel] [PATCH] Getting and setting SEDF scheduling parameters
> Note that this patch makes strong assumptions about how the scheduling > parameters are used. So, I recommend someone take a really close look at > my comments to make sure I''ve preserved the Xen team''s intentions for how > the SEDF scheduler works. :-)I think that the current GET/PUT_INFO call is definitely screwed. The intended use of extratime should be to allow time-driven domains to get a best-effort weighted slice of otherwise-idle cpu. Extratime is not a completely separate scheduling category in its own right! :-) The scheduling logic should be something like: (a) schedule runnable time-driven domains with time slice left; then (b) schedule runnable weight-driven domains; then (c) schedule extratime-aware time-driven domains. Apart from this there is a bunch of scheduler complexity to try and sanely handle I/O workloads (short-blocking domains). Depending on how unused time slices are divvied up, it may make sense to allow real-time-weight-driven domains also to specify extratime-awareness (depends on whether real-time weights divvy up all available cpu (non-time-sliced and unused time-sliced), or just the spare non-time-sliced time according to the predetermined schedule). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John L Griffin
2006-Jan-09 20:42 UTC
Re: [Xen-devel] [PATCH] Getting and setting SEDF scheduling parameters
Here is a new patch to reflect Keir''s directions from last Friday. Note that the patch only addresses the GET/PUT_INFO logic (not the correctness of the scheduler proper) but the scheduler seems to indeed be doing the right thing. This patch: 1. Fixes an underflow bug in sedf_adjust_weights() that would cause the <slice> for a weight-driven domain to be set to a really big number if the CPU was already overcommitted. 2. Clarifies the logic in sedf_adjdom(). Whenever (weight==0), time-driven scheduling is selected. Otherwise, weight-driven scheduling is selected. Extratime scheduling works for both modes. [Note to Keir: in re your question, real-time weights only divvy up the spare non-time-sliced time according to the predetermined schedule.] 3. Adds a heap of comments to the code, including five examples of how one might set the scheduling parameters. Each of the five examples has been non-rigorously tested to work as described, but additional testing is warranted. One additional change I recommend is to add printk()''s to sedf_adjdom() that indicate the failure of a scheduling operation, and possibly to indicate success as well, but that''s not included in this patch. Signed-off-by: jlg@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stephan Diestelhorst
2006-Jan-12 07:29 UTC
Re: [Xen-devel] [PATCH] Getting and setting SEDF scheduling parameters
John L Griffin wrote:>This patch addresses three problems in the function sedf_adjdom(): > >3) The code logic in this function is cryptic, and there is not much >documentation on how the scheduling parameters should be used. The >attached patch adds comments to the sedf_adjdom() function, and >reorders/rewrites the logic of the SCHED_INFO_PUT handling to make the >code more self-documenting. > >I know, the main problem is, that there are quite a number of different interpretations for some of the values, depending on the others. This caused some cryptic code as you point out properly, which I wasn''t really happy with! Stephan>Note that this patch makes strong assumptions about how the scheduling >parameters are used. So, I recommend someone take a really close look at >my comments to make sure I''ve preserved the Xen team''s intentions for how >the SEDF scheduler works. :-) > >Signed-off-by: jlg@us.ibm.com > > > >------------------------------------------------------------------------ > >_______________________________________________ >Xen-devel mailing list >Xen-devel@lists.xensource.com >http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stephan Diestelhorst
2006-Jan-12 07:45 UTC
Re: [Xen-devel] [PATCH] Getting and setting SEDF scheduling parameters
Thanks for that, I''ll have a look at it! Stephan John L Griffin wrote:>Here is a new patch to reflect Keir''s directions from last Friday. Note >that the patch only addresses the GET/PUT_INFO logic (not the correctness >of the scheduler proper) but the scheduler seems to indeed be doing the >right thing. > >This patch: > >1. Fixes an underflow bug in sedf_adjust_weights() that would cause the ><slice> for a weight-driven domain to be set to a really big number if the >CPU was already overcommitted. > >2. Clarifies the logic in sedf_adjdom(). Whenever (weight==0), >time-driven scheduling is selected. Otherwise, weight-driven scheduling >is selected. Extratime scheduling works for both modes. [Note to Keir: >in re your question, real-time weights only divvy up the spare >non-time-sliced time according to the predetermined schedule.] > >3. Adds a heap of comments to the code, including five examples of how one >might set the scheduling parameters. Each of the five examples has been >non-rigorously tested to work as described, but additional testing is >warranted. > >One additional change I recommend is to add printk()''s to sedf_adjdom() >that indicate the failure of a scheduling operation, and possibly to >indicate success as well, but that''s not included in this patch. > >Signed-off-by: jlg@us.ibm.com > > > >------------------------------------------------------------------------ > >_______________________________________________ >Xen-devel mailing list >Xen-devel@lists.xensource.com >http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel