From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Keir Fraser <keir@xen.org>,
Ian Campbell <Ian.Campbell@eu.citrix.com>,
Tim Deegan <tim@xen.org>
Subject: Re: [PATCH] introduce and used relaxed cpumask operations
Date: Wed, 21 Jan 2015 12:21:37 +0000 [thread overview]
Message-ID: <54BF99D1.9050709@citrix.com> (raw)
In-Reply-To: <54BD379C0200007800056965@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 5132 bytes --]
On 19/01/15 15:58, Jan Beulich wrote:
> --- a/xen/common/core_parking.c
> +++ b/xen/common/core_parking.c
> @@ -75,11 +75,10 @@ static unsigned int core_parking_perform
> if ( core_weight < core_tmp )
> {
> core_weight = core_tmp;
> - cpumask_clear(&core_candidate_map);
> - cpumask_set_cpu(cpu, &core_candidate_map);
> + cpumask_copy(&core_candidate_map, cpumask_of(cpu));
It is probably worth mentioning changes like this in the commit message,
as they are slightly more than just a simple removal of the lock prefix.
> }
> else if ( core_weight == core_tmp )
> - cpumask_set_cpu(cpu, &core_candidate_map);
> + __cpumask_set_cpu(cpu, &core_candidate_map);
> }
>
> for_each_cpu(cpu, &core_candidate_map)
> --- a/xen/common/sched_rt.c
> +++ b/xen/common/sched_rt.c
> @@ -663,7 +663,7 @@ burn_budget(const struct scheduler *ops,
> * lock is grabbed before calling this function
> */
> static struct rt_vcpu *
> -__runq_pick(const struct scheduler *ops, cpumask_t *mask)
> +__runq_pick(const struct scheduler *ops, const cpumask_t *mask)
> {
> struct list_head *runq = rt_runq(ops);
> struct list_head *iter;
> @@ -780,10 +780,7 @@ rt_schedule(const struct scheduler *ops,
> }
> else
> {
> - cpumask_t cur_cpu;
> - cpumask_clear(&cur_cpu);
> - cpumask_set_cpu(cpu, &cur_cpu);
> - snext = __runq_pick(ops, &cur_cpu);
> + snext = __runq_pick(ops, cpumask_of(cpu));
> if ( snext == NULL )
> snext = rt_vcpu(idle_vcpu[cpu]);
>
> --- a/xen/common/softirq.c
> +++ b/xen/common/softirq.c
> @@ -88,7 +88,7 @@ void cpumask_raise_softirq(const cpumask
> if ( !test_and_set_bit(nr, &softirq_pending(cpu)) &&
> cpu != this_cpu &&
> !arch_skip_send_event_check(cpu) )
> - cpumask_set_cpu(cpu, raise_mask);
> + __cpumask_set_cpu(cpu, raise_mask);
>
> if ( raise_mask == &send_mask )
> smp_send_event_check_mask(raise_mask);
> @@ -106,7 +106,7 @@ void cpu_raise_softirq(unsigned int cpu,
> if ( !per_cpu(batching, this_cpu) || in_irq() )
> smp_send_event_check_cpu(cpu);
> else
> - set_bit(nr, &per_cpu(batch_mask, this_cpu));
> + __cpumask_set_cpu(nr, &per_cpu(batch_mask, this_cpu));
> }
>
> void cpu_raise_softirq_batch_begin(void)
> @@ -122,7 +122,7 @@ void cpu_raise_softirq_batch_finish(void
> ASSERT(per_cpu(batching, this_cpu));
> for_each_cpu ( cpu, mask )
> if ( !softirq_pending(cpu) )
> - cpumask_clear_cpu(cpu, mask);
> + __cpumask_clr_cpu(cpu, mask);
> smp_send_event_check_mask(mask);
> cpumask_clear(mask);
> --per_cpu(batching, this_cpu);
> --- a/xen/include/xen/cpumask.h
> +++ b/xen/include/xen/cpumask.h
> @@ -103,11 +103,21 @@ static inline void cpumask_set_cpu(int c
> set_bit(cpumask_check(cpu), dstp->bits);
> }
>
> +static inline void __cpumask_set_cpu(int cpu, cpumask_t *dstp)
> +{
> + __set_bit(cpumask_check(cpu), dstp->bits);
> +}
> +
> static inline void cpumask_clear_cpu(int cpu, volatile cpumask_t *dstp)
> {
> clear_bit(cpumask_check(cpu), dstp->bits);
> }
>
> +static inline void __cpumask_clr_cpu(int cpu, cpumask_t *dstp)
> +{
> + __clear_bit(cpumask_check(cpu), dstp->bits);
> +}
> +
While I can appreciate the want for a shorter function name, I feel that
consistency with its locked alternative is more important.
> static inline void cpumask_setall(cpumask_t *dstp)
> {
> bitmap_fill(dstp->bits, nr_cpumask_bits);
> @@ -122,16 +132,26 @@ static inline void cpumask_clear(cpumask
> #define cpumask_test_cpu(cpu, cpumask) \
> test_bit(cpumask_check(cpu), (cpumask)->bits)
>
> -static inline int cpumask_test_and_set_cpu(int cpu, cpumask_t *addr)
> +static inline int cpumask_test_and_set_cpu(int cpu, volatile cpumask_t *addr)
> {
> return test_and_set_bit(cpumask_check(cpu), addr->bits);
> }
>
> -static inline int cpumask_test_and_clear_cpu(int cpu, cpumask_t *addr)
> +static inline int __cpumask_tst_set_cpu(int cpu, cpumask_t *addr)
> +{
> + return __test_and_set_bit(cpumask_check(cpu), addr->bits);
> +}
> +
> +static inline int cpumask_test_and_clear_cpu(int cpu, volatile cpumask_t *addr)
This introduction of volatile also need mentioning in the commit
message, but I would agree that it should be here.
~Andrew
> {
> return test_and_clear_bit(cpumask_check(cpu), addr->bits);
> }
>
> +static inline int __cpumask_tst_clr_cpu(int cpu, cpumask_t *addr)
> +{
> + return __test_and_clear_bit(cpumask_check(cpu), addr->bits);
> +}
> +
> static inline void cpumask_and(cpumask_t *dstp, const cpumask_t *src1p,
> const cpumask_t *src2p)
> {
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 5965 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-01-21 12:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 15:58 [PATCH] introduce and used relaxed cpumask operations Jan Beulich
2015-01-21 12:21 ` Andrew Cooper [this message]
2015-01-21 14:10 ` Jan Beulich
2015-01-22 15:29 ` Tim Deegan
2015-01-21 14:28 ` George Dunlap
2015-01-21 14:35 ` Jan Beulich
2015-01-21 14:42 ` George Dunlap
2015-01-21 15:06 ` Jan Beulich
2015-01-21 15:10 ` George Dunlap
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=54BF99D1.9050709@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--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 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.