From: Juergen Gross <jgross@suse.com>
To: keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com,
dario.faggioli@citrix.com, george.dunlap@eu.citrix.com,
xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>
Subject: [PATCH 2/5] xen: use masking operation instead of test_bit for CSFLAG bits
Date: Fri, 2 Oct 2015 06:40:27 +0200 [thread overview]
Message-ID: <1443760830-29095-3-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1443760830-29095-1-git-send-email-jgross@suse.com>
Use a bit mask for testing of a set bit instead of test_bit in case no
atomic operation is needed, as this will lead to smaller and more
effective code.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
xen/common/sched_credit2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index bf1fe6f..912e1a2 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -418,7 +418,7 @@ __runq_insert(struct list_head *runq, struct csched2_vcpu *svc)
/* Idle vcpus not allowed on the runqueue anymore */
BUG_ON(is_idle_vcpu(svc->vcpu));
BUG_ON(svc->vcpu->is_running);
- BUG_ON(test_bit(__CSFLAG_scheduled, &svc->flags));
+ BUG_ON(svc->flags & CSFLAG_scheduled);
list_for_each( iter, runq )
{
@@ -844,7 +844,7 @@ static void
__runq_deassign(struct csched2_vcpu *svc)
{
BUG_ON(__vcpu_on_runq(svc));
- BUG_ON(test_bit(__CSFLAG_scheduled, &svc->flags));
+ BUG_ON(svc->flags & CSFLAG_scheduled);
list_del_init(&svc->rqd_elem);
update_max_weight(svc->rqd, 0, svc->weight);
@@ -952,7 +952,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc)
update_load(ops, svc->rqd, svc, -1, NOW());
__runq_remove(svc);
}
- else if ( test_bit(__CSFLAG_delayed_runq_add, &svc->flags) )
+ else if ( svc->flags & CSFLAG_delayed_runq_add )
clear_bit(__CSFLAG_delayed_runq_add, &svc->flags);
}
@@ -988,7 +988,7 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc)
/* If the context hasn't been saved for this vcpu yet, we can't put it on
* another runqueue. Instead, we set a flag so that it will be put on the runqueue
* after the context has been saved. */
- if ( unlikely (test_bit(__CSFLAG_scheduled, &svc->flags) ) )
+ if ( unlikely(svc->flags & CSFLAG_scheduled) )
{
set_bit(__CSFLAG_delayed_runq_add, &svc->flags);
goto out;
@@ -1204,7 +1204,7 @@ static void migrate(const struct scheduler *ops,
struct csched2_runqueue_data *trqd,
s_time_t now)
{
- if ( test_bit(__CSFLAG_scheduled, &svc->flags) )
+ if ( svc->flags & CSFLAG_scheduled )
{
d2printk("%pv %d-%d a\n", svc->vcpu, svc->rqd->id, trqd->id);
/* It's running; mark it to migrate. */
@@ -1348,7 +1348,7 @@ retry:
__update_svc_load(ops, push_svc, 0, now);
/* Skip this one if it's already been flagged to migrate */
- if ( test_bit(__CSFLAG_runq_migrate_request, &push_svc->flags) )
+ if ( push_svc->flags & CSFLAG_runq_migrate_request )
continue;
list_for_each( pull_iter, &st.orqd->svc )
@@ -1361,7 +1361,7 @@ retry:
}
/* Skip this one if it's already been flagged to migrate */
- if ( test_bit(__CSFLAG_runq_migrate_request, &pull_svc->flags) )
+ if ( pull_svc->flags & CSFLAG_runq_migrate_request )
continue;
consider(&st, push_svc, pull_svc);
@@ -1378,7 +1378,7 @@ retry:
struct csched2_vcpu * pull_svc = list_entry(pull_iter, struct csched2_vcpu, rqd_elem);
/* Skip this one if it's already been flagged to migrate */
- if ( test_bit(__CSFLAG_runq_migrate_request, &pull_svc->flags) )
+ if ( pull_svc->flags & CSFLAG_runq_migrate_request )
continue;
/* Consider pull only */
--
2.1.4
next prev parent reply other threads:[~2015-10-02 4:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 4:40 [PATCH 0/5] use mask operations instead of test_bit() Juergen Gross
2015-10-02 4:40 ` [PATCH 1/5] xen: use masking operation instead of test_bit for RTDS bits Juergen Gross
2015-10-02 10:21 ` Dario Faggioli
2015-10-05 13:30 ` George Dunlap
2015-10-02 4:40 ` Juergen Gross [this message]
2015-10-02 10:45 ` [PATCH 2/5] xen: use masking operation instead of test_bit for CSFLAG bits Dario Faggioli
2015-10-05 13:30 ` George Dunlap
2015-10-02 4:40 ` [PATCH 3/5] xen: use masking operation instead of test_bit for VGCF bits Juergen Gross
2015-10-02 4:40 ` [PATCH 4/5] xen: use masking operation instead of test_bit for VPF bits Juergen Gross
2015-10-05 13:18 ` George Dunlap
2015-10-05 13:36 ` Jan Beulich
2015-10-05 13:45 ` George Dunlap
2015-10-05 14:05 ` Jan Beulich
2015-10-05 14:31 ` George Dunlap
2015-10-05 13:39 ` Juergen Gross
2015-10-05 13:24 ` George Dunlap
2015-10-05 13:40 ` Jan Beulich
2015-10-02 4:40 ` [PATCH 5/5] xen: use masking operation instead of test_bit for MCSF bits Juergen Gross
2015-10-02 9:03 ` [PATCH 0/5] use mask operations instead of test_bit() Dario Faggioli
2015-10-02 9:10 ` Juergen Gross
2015-10-02 9:33 ` Dario Faggioli
2015-10-02 9:44 ` Jan Beulich
2015-10-02 9:47 ` Andrew Cooper
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=1443760830-29095-3-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--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).