From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Josh Whitehead <josh.whitehead@dornerworks.com>,
Robert VanVossen <robert.vanvossen@dornerworks.com>
Subject: [PATCH 5/9] xen: sched: make implementing .alloc_pdata optional
Date: Tue, 29 Sep 2015 18:56:04 +0200 [thread overview]
Message-ID: <20150929165604.17589.24387.stgit@Solace.station> (raw)
In-Reply-To: <20150929164726.17589.96920.stgit@Solace.station>
The .alloc_pdata hook of the scheduler interface is
called, in schedule_cpu_switch(), unconditionally,
for all schedulers.
This forces even schedulers that do not require any
actual allocation of per-pCPU data to:
- contain an implementation of the hook;
- return some artificial non-NULL value to make
such a caller happy.
This changes allows schedulers that do not need per-pCPU
allocations to avoid implementing the hook. It also
kills such artificial implementation from the ARINC653
scheduler (and, while there, it nukes .free_pdata from
there too, which is equally useless).
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Robert VanVossen <robert.vanvossen@dornerworks.com>
Cc: Josh Whitehead <josh.whitehead@dornerworks.com>
---
xen/common/sched_arinc653.c | 31 -------------------------------
xen/common/schedule.c | 6 +++---
2 files changed, 3 insertions(+), 34 deletions(-)
diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c
index cff5da9..ef192c3 100644
--- a/xen/common/sched_arinc653.c
+++ b/xen/common/sched_arinc653.c
@@ -455,34 +455,6 @@ a653sched_free_vdata(const struct scheduler *ops, void *priv)
}
/**
- * This function allocates scheduler-specific data for a physical CPU
- *
- * We do not actually make use of any per-CPU data but the hypervisor expects
- * a non-NULL return value
- *
- * @param ops Pointer to this instance of the scheduler structure
- *
- * @return Pointer to the allocated data
- */
-static void *
-a653sched_alloc_pdata(const struct scheduler *ops, int cpu)
-{
- /* return a non-NULL value to keep schedule.c happy */
- return SCHED_PRIV(ops);
-}
-
-/**
- * This function frees scheduler-specific data for a physical CPU
- *
- * @param ops Pointer to this instance of the scheduler structure
- */
-static void
-a653sched_free_pdata(const struct scheduler *ops, void *pcpu, int cpu)
-{
- /* nop */
-}
-
-/**
* This function allocates scheduler-specific data for a domain
*
* We do not actually make use of any per-domain data but the hypervisor
@@ -736,9 +708,6 @@ const struct scheduler sched_arinc653_def = {
.free_vdata = a653sched_free_vdata,
.alloc_vdata = a653sched_alloc_vdata,
- .free_pdata = a653sched_free_pdata,
- .alloc_pdata = a653sched_alloc_pdata,
-
.free_domdata = a653sched_free_domdata,
.alloc_domdata = a653sched_alloc_domdata,
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 83244d7..0e02af2 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1493,7 +1493,7 @@ void __init scheduler_init(void)
int schedule_cpu_switch(unsigned int cpu, struct cpupool *c)
{
struct vcpu *idle;
- void *ppriv, *ppriv_old, *vpriv, *vpriv_old;
+ void *ppriv = NULL, *ppriv_old, *vpriv, *vpriv_old;
struct scheduler *old_ops = per_cpu(scheduler, cpu);
struct scheduler *new_ops = (c == NULL) ? &ops : c->sched;
@@ -1501,8 +1501,8 @@ int schedule_cpu_switch(unsigned int cpu, struct cpupool *c)
return 0;
idle = idle_vcpu[cpu];
- ppriv = SCHED_OP(new_ops, alloc_pdata, cpu);
- if ( ppriv == NULL )
+ if ( (new_ops->alloc_pdata != NULL) &&
+ ((ppriv = new_ops->alloc_pdata(new_ops, cpu)) == NULL) )
return -ENOMEM;
vpriv = SCHED_OP(new_ops, alloc_vdata, idle, idle->domain->sched_priv);
if ( vpriv == NULL )
next prev parent reply other threads:[~2015-09-29 16:56 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 16:55 [PATCH 0/9] xen: sched: improve (a lot! :-D) Credit2 runqueue handling Dario Faggioli
2015-09-29 16:55 ` [PATCH 1/9] xen: sched: fix an 'off by one \t' in credit2 debug dump Dario Faggioli
2015-10-01 5:22 ` Juergen Gross
2015-10-08 14:09 ` George Dunlap
2015-09-29 16:55 ` [PATCH 2/9] xen: sched: improve scope and placement of credit2 boot parameters Dario Faggioli
2015-10-01 5:23 ` Juergen Gross
2015-10-01 7:51 ` Jan Beulich
2015-10-01 8:17 ` Dario Faggioli
2015-09-29 16:55 ` [PATCH 3/9] xen: sched: make locking for {insert, remove}_vcpu consistent Dario Faggioli
2015-09-29 17:31 ` Andrew Cooper
2015-09-29 21:40 ` Dario Faggioli
2015-09-29 21:56 ` Dario Faggioli
2015-09-30 9:00 ` Andrew Cooper
2015-10-08 14:58 ` George Dunlap
2015-10-08 15:20 ` Andrew Cooper
2015-10-08 16:46 ` George Dunlap
2015-10-08 17:23 ` Andrew Cooper
2015-10-08 20:44 ` Dario Faggioli
2015-10-12 9:44 ` George Dunlap
2015-10-08 20:39 ` Dario Faggioli
2015-10-09 13:05 ` Andrew Cooper
2015-10-09 16:56 ` Dario Faggioli
2015-10-01 8:03 ` Jan Beulich
2015-10-01 11:59 ` Dario Faggioli
2015-09-29 16:55 ` [PATCH 4/9] xen: sched: add .init_pdata hook to the scheduler interface Dario Faggioli
2015-10-01 5:21 ` Juergen Gross
2015-10-01 6:33 ` Dario Faggioli
2015-10-01 7:43 ` Juergen Gross
2015-10-01 9:32 ` Andrew Cooper
2015-10-01 9:40 ` Dario Faggioli
2015-10-01 8:17 ` Jan Beulich
2015-10-01 9:26 ` Dario Faggioli
2015-10-01 10:12 ` Jan Beulich
2015-10-01 10:35 ` Dario Faggioli
2015-10-01 10:47 ` Jan Beulich
2015-09-29 16:56 ` Dario Faggioli [this message]
2015-10-01 5:28 ` [PATCH 5/9] xen: sched: make implementing .alloc_pdata optional Juergen Gross
2015-10-01 6:35 ` Dario Faggioli
2015-10-01 7:49 ` Jan Beulich
2015-10-01 8:13 ` Dario Faggioli
2015-09-29 16:56 ` [PATCH 6/9] xen: sched: implement .init_pdata in all schedulers Dario Faggioli
2015-09-29 16:56 ` [PATCH 7/9] xen: sched: fix per-socket runqueue creation in credit2 Dario Faggioli
2015-09-29 16:56 ` [PATCH 8/9] xen: sched: allow for choosing credit2 runqueues configuration at boot Dario Faggioli
2015-10-01 5:48 ` Juergen Gross
2015-10-01 7:23 ` Dario Faggioli
2015-10-01 7:46 ` Juergen Gross
2015-09-29 16:56 ` [PATCH 9/9] xen: sched: per-core runqueues as default in credit2 Dario Faggioli
2015-10-01 5:48 ` Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150929165604.17589.24387.stgit@Solace.station \
--to=dario.faggioli@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=josh.whitehead@dornerworks.com \
--cc=robert.vanvossen@dornerworks.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).