From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Dario Faggioli <dfaggioli@suse.com>
Subject: [PATCH 2/6] xen/credit2: Move repl_timer into struct csched2_dom
Date: Wed, 28 Feb 2018 14:14:24 +0000 [thread overview]
Message-ID: <1519827268-18199-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1519827268-18199-1-git-send-email-andrew.cooper3@citrix.com>
For exactly the same reason as 418ae6021d. Having a separate allocation is
unnecessary and wasteful.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: George Dunlap <george.dunlap@eu.citrix.com>
CC: Dario Faggioli <dfaggioli@suse.com>
---
xen/common/sched_credit2.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index ee9768e..b094b3c 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -547,7 +547,7 @@ struct csched2_dom {
s_time_t tot_budget; /* Total amount of budget */
s_time_t budget; /* Currently available budget */
- struct timer *repl_timer; /* Timer for periodic replenishment of budget */
+ struct timer repl_timer; /* Timer for periodic replenishment of budget */
s_time_t next_repl; /* Time at which next replenishment occurs */
struct list_head parked_vcpus; /* List of CPUs waiting for budget */
@@ -1974,7 +1974,7 @@ static void replenish_domain_budget(void* data)
unpark_parked_vcpus(sdom->dom->cpupool->sched, &parked);
out:
- set_timer(sdom->repl_timer, sdom->next_repl);
+ set_timer(&sdom->repl_timer, sdom->next_repl);
}
#ifndef NDEBUG
@@ -2874,7 +2874,7 @@ csched2_dom_cntl(
*/
sdom->budget = sdom->tot_budget;
sdom->next_repl = NOW() + CSCHED2_BDGT_REPL_PERIOD;
- set_timer(sdom->repl_timer, sdom->next_repl);
+ set_timer(&sdom->repl_timer, sdom->next_repl);
/*
* Now, let's enable budget accounting for all the vCPUs.
@@ -2933,7 +2933,7 @@ csched2_dom_cntl(
{
LIST_HEAD(parked);
- stop_timer(sdom->repl_timer);
+ stop_timer(&sdom->repl_timer);
/* Disable budget accounting for all the vCPUs. */
for_each_vcpu ( d, v )
@@ -3014,13 +3014,6 @@ csched2_alloc_domdata(const struct scheduler *ops, struct domain *dom)
if ( sdom == NULL )
return NULL;
- sdom->repl_timer = xzalloc(struct timer);
- if ( sdom->repl_timer == NULL )
- {
- xfree(sdom);
- return NULL;
- }
-
/* Initialize credit, cap and weight */
INIT_LIST_HEAD(&sdom->sdom_elem);
sdom->dom = dom;
@@ -3028,7 +3021,7 @@ csched2_alloc_domdata(const struct scheduler *ops, struct domain *dom)
sdom->cap = 0U;
sdom->nr_vcpus = 0;
- init_timer(sdom->repl_timer, replenish_domain_budget, sdom,
+ init_timer(&sdom->repl_timer, replenish_domain_budget, sdom,
cpumask_any(cpupool_domain_cpumask(dom)));
spin_lock_init(&sdom->budget_lock);
INIT_LIST_HEAD(&sdom->parked_vcpus);
@@ -3066,7 +3059,7 @@ csched2_free_domdata(const struct scheduler *ops, void *data)
struct csched2_dom *sdom = data;
struct csched2_private *prv = csched2_priv(ops);
- kill_timer(sdom->repl_timer);
+ kill_timer(&sdom->repl_timer);
write_lock_irqsave(&prv->lock, flags);
@@ -3074,7 +3067,6 @@ csched2_free_domdata(const struct scheduler *ops, void *data)
write_unlock_irqrestore(&prv->lock, flags);
- xfree(sdom->repl_timer);
xfree(data);
}
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-02-28 14:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 14:14 [PATCH 0/6] Assorted improvements to domain creation Andrew Cooper
2018-02-28 14:14 ` [PATCH 1/6] xen/domain: Reduce the quantity of initialisation for system domains Andrew Cooper
2018-02-28 15:22 ` George Dunlap
2018-03-01 10:10 ` Dario Faggioli
2018-02-28 14:14 ` Andrew Cooper [this message]
2018-02-28 15:26 ` [PATCH 2/6] xen/credit2: Move repl_timer into struct csched2_dom George Dunlap
2018-03-01 10:12 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 3/6] xen/sched: Improvements to the {alloc, free}_domdata() interfaces Andrew Cooper
2018-02-28 15:40 ` George Dunlap
2018-02-28 16:31 ` Meng Xu
2018-03-01 10:39 ` Dario Faggioli
2018-03-05 18:20 ` Andrew Cooper
2018-02-28 14:14 ` [PATCH 4/6] xen/sched: Remove {init, destroy}_domain() interfaces Andrew Cooper
2018-02-28 16:22 ` George Dunlap
2018-02-28 16:33 ` Andrew Cooper
2018-03-01 11:08 ` Dario Faggioli
2018-02-28 16:34 ` Meng Xu
2018-03-01 11:00 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 5/6] xen/domain: Call sched_destroy_domain() in the domain_create() error path Andrew Cooper
2018-02-28 16:24 ` George Dunlap
2018-03-01 13:25 ` Dario Faggioli
2018-03-01 13:27 ` Dario Faggioli
2018-02-28 14:14 ` [PATCH 6/6] xen/domain: Use IS_ERR_OR_NULL() when checking the return value of domain_create() Andrew Cooper
2018-02-28 16:36 ` George Dunlap
2018-03-07 19:12 ` [PATCH v2 6/6] xen/domain: Added debug safety in the domain_create() failure path Andrew Cooper
2018-03-08 9:04 ` Jan Beulich
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=1519827268-18199-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=dfaggioli@suse.com \
--cc=george.dunlap@eu.citrix.com \
--cc=xen-devel@lists.xen.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).