Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-20 Thread Roger Pau Monné
On Thu, Feb 20, 2020 at 08:57:33AM +, Julien Grall wrote: > > > On 20/02/2020 08:36, Jan Beulich wrote: > > On 20.02.2020 09:27, Jürgen Groß wrote: > > > On 20.02.20 09:13, Jan Beulich wrote: > > > > On 13.02.2020 12:32, Roger Pau Monne wrote: > > > > > Most users of the cpu maps just care ab

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-20 Thread Julien Grall
On 20/02/2020 08:36, Jan Beulich wrote: On 20.02.2020 09:27, Jürgen Groß wrote: On 20.02.20 09:13, Jan Beulich wrote: On 13.02.2020 12:32, Roger Pau Monne wrote: Most users of the cpu maps just care about the maps not changing while the lock is being held, but don't actually modify the maps.

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-20 Thread Jan Beulich
On 20.02.2020 09:27, Jürgen Groß wrote: > On 20.02.20 09:13, Jan Beulich wrote: >> On 13.02.2020 12:32, Roger Pau Monne wrote: >>> Most users of the cpu maps just care about the maps not changing while >>> the lock is being held, but don't actually modify the maps. >>> >>> Convert the lock into a r

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-20 Thread Jürgen Groß
On 20.02.20 09:13, Jan Beulich wrote: On 13.02.2020 12:32, Roger Pau Monne wrote: Most users of the cpu maps just care about the maps not changing while the lock is being held, but don't actually modify the maps. Convert the lock into a rw lock, and take the lock in read mode in get_cpu_maps an

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-20 Thread Jan Beulich
On 13.02.2020 12:32, Roger Pau Monne wrote: > Most users of the cpu maps just care about the maps not changing while > the lock is being held, but don't actually modify the maps. > > Convert the lock into a rw lock, and take the lock in read mode in > get_cpu_maps and in write mode in cpu_hotplug_

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-19 Thread Roger Pau Monné
On Wed, Feb 19, 2020 at 02:42:58PM +0100, Jan Beulich wrote: > On 19.02.2020 14:19, Roger Pau Monné wrote: > > On Wed, Feb 19, 2020 at 01:56:02PM +0100, Jan Beulich wrote: > >> On 13.02.2020 12:32, Roger Pau Monne wrote: > >>> void __init register_cpu_notifier(struct notifier_block *nb) > >>> { >

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-19 Thread Jan Beulich
On 19.02.2020 14:19, Roger Pau Monné wrote: > On Wed, Feb 19, 2020 at 01:56:02PM +0100, Jan Beulich wrote: >> On 13.02.2020 12:32, Roger Pau Monne wrote: >>> void __init register_cpu_notifier(struct notifier_block *nb) >>> { >>> -if ( !spin_trylock(&cpu_add_remove_lock) ) >>> +if ( !write

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-19 Thread Roger Pau Monné
On Wed, Feb 19, 2020 at 01:56:02PM +0100, Jan Beulich wrote: > On 13.02.2020 12:32, Roger Pau Monne wrote: > > void __init register_cpu_notifier(struct notifier_block *nb) > > { > > -if ( !spin_trylock(&cpu_add_remove_lock) ) > > +if ( !write_trylock(&cpu_add_remove_lock) ) > > B

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-19 Thread Jan Beulich
On 13.02.2020 12:32, Roger Pau Monne wrote: > void __init register_cpu_notifier(struct notifier_block *nb) > { > -if ( !spin_trylock(&cpu_add_remove_lock) ) > +if ( !write_trylock(&cpu_add_remove_lock) ) > BUG(); /* Should never fail as we are called only during boot. */ > n

Re: [Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-19 Thread Julien Grall
Hi Roger, On 13/02/2020 11:32, Roger Pau Monne wrote: Most users of the cpu maps just care about the maps not changing while the lock is being held, but don't actually modify the maps. Convert the lock into a rw lock, and take the lock in read mode in get_cpu_maps and in write mode in cpu_hotpl

[Xen-devel] [PATCH 1/2] smp: convert the cpu maps lock into a rw lock

2020-02-13 Thread Roger Pau Monne
Most users of the cpu maps just care about the maps not changing while the lock is being held, but don't actually modify the maps. Convert the lock into a rw lock, and take the lock in read mode in get_cpu_maps and in write mode in cpu_hotplug_begin. This will lower the contention around the lock,