All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Jeremy.Linton@arm.com,
	peterz@infradead.org, mingo@redhat.com, boqun.feng@gmail.com,
	paulmck@linux.vnet.ibm.com
Subject: Re: [PATCH v2 4/5] arm64: locking: Move rwlock implementation over to qrwlocks
Date: Wed, 11 Oct 2017 12:49:05 +0100	[thread overview]
Message-ID: <20171011114905.GA27426@arm.com> (raw)
In-Reply-To: <909c3e84-745c-20db-a071-f9e0f2cbe63a@redhat.com>

Hi Waiman,

On Mon, Oct 09, 2017 at 09:34:08PM -0400, Waiman Long wrote:
> On 10/06/2017 09:34 AM, Will Deacon wrote:
> > Now that the qrwlock can make use of WFE, remove our homebrew rwlock
> > code in favour of the generic queued implementation.
> >
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> >  arch/arm64/Kconfig                      |  17 ++++
> >  arch/arm64/include/asm/Kbuild           |   1 +
> >  arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
> >  arch/arm64/include/asm/spinlock_types.h |   6 +-
> >  4 files changed, 20 insertions(+), 168 deletions(-)
> >
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 0df64a6a56d4..6d32c9b0d4bb 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -22,7 +22,24 @@ config ARM64
> >  	select ARCH_HAS_STRICT_MODULE_RWX
> >  	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> >  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if ACPI_APEI_SEA
> > +	select ARCH_INLINE_READ_LOCK if !PREEMPT
> > +	select ARCH_INLINE_READ_LOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK_IRQSAVE if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK_IRQSAVE if !PREEMPT
> >  	select ARCH_USE_CMPXCHG_LOCKREF
> > +	select ARCH_USE_QUEUED_RWLOCKS
> >  	select ARCH_SUPPORTS_MEMORY_FAILURE
> >  	select ARCH_SUPPORTS_ATOMIC_RMW
> >  	select ARCH_SUPPORTS_NUMA_BALANCING
> 
> Inlining is good for performance, but it may come with an increase in
> kernel text size. Inlining unlock and unlock_irq are OK, but the other
> inlines will increase the text size of the kernel. Have you measured how
> much size increase will that be? Is there any concern about the
> increased text size?

Yes, I did look at the disassembly and bloat-o-meter results. Inlining
these functions means that the fastpath sits entirely within a 64-byte
cacheline and bloat-o-meter shows a relatively small increase in vmlinux
size for a defconfig build with CONFIG_PREEMPT disabled:

Total: Before=13800924, After=13812904, chg +0.09%

(I also just noticed my typos in ARCH_INLINE_{READ.WRITE}_UNLOCK_IRQSAVE
so I regenerated the numbers!)

Will

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/5] arm64: locking: Move rwlock implementation over to qrwlocks
Date: Wed, 11 Oct 2017 12:49:05 +0100	[thread overview]
Message-ID: <20171011114905.GA27426@arm.com> (raw)
In-Reply-To: <909c3e84-745c-20db-a071-f9e0f2cbe63a@redhat.com>

Hi Waiman,

On Mon, Oct 09, 2017 at 09:34:08PM -0400, Waiman Long wrote:
> On 10/06/2017 09:34 AM, Will Deacon wrote:
> > Now that the qrwlock can make use of WFE, remove our homebrew rwlock
> > code in favour of the generic queued implementation.
> >
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> >  arch/arm64/Kconfig                      |  17 ++++
> >  arch/arm64/include/asm/Kbuild           |   1 +
> >  arch/arm64/include/asm/spinlock.h       | 164 +-------------------------------
> >  arch/arm64/include/asm/spinlock_types.h |   6 +-
> >  4 files changed, 20 insertions(+), 168 deletions(-)
> >
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 0df64a6a56d4..6d32c9b0d4bb 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -22,7 +22,24 @@ config ARM64
> >  	select ARCH_HAS_STRICT_MODULE_RWX
> >  	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> >  	select ARCH_HAVE_NMI_SAFE_CMPXCHG if ACPI_APEI_SEA
> > +	select ARCH_INLINE_READ_LOCK if !PREEMPT
> > +	select ARCH_INLINE_READ_LOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_READ_UNLOCK_IRQSAVE if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPT
> > +	select ARCH_INLINE_WRITE_UNLOCK_IRQSAVE if !PREEMPT
> >  	select ARCH_USE_CMPXCHG_LOCKREF
> > +	select ARCH_USE_QUEUED_RWLOCKS
> >  	select ARCH_SUPPORTS_MEMORY_FAILURE
> >  	select ARCH_SUPPORTS_ATOMIC_RMW
> >  	select ARCH_SUPPORTS_NUMA_BALANCING
> 
> Inlining is good for performance, but it may come with an increase in
> kernel text size. Inlining unlock and unlock_irq are OK, but the other
> inlines will increase the text size of the kernel. Have you measured how
> much size increase will that be? Is there any concern about the
> increased text size?

Yes, I did look at the disassembly and bloat-o-meter results. Inlining
these functions means that the fastpath sits entirely within a 64-byte
cacheline and bloat-o-meter shows a relatively small increase in vmlinux
size for a defconfig build with CONFIG_PREEMPT disabled:

Total: Before=13800924, After=13812904, chg +0.09%

(I also just noticed my typos in ARCH_INLINE_{READ.WRITE}_UNLOCK_IRQSAVE
so I regenerated the numbers!)

Will

  reply	other threads:[~2017-10-11 11:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 13:34 [PATCH v2 0/5] Switch arm64 over to qrwlock Will Deacon
2017-10-06 13:34 ` Will Deacon
2017-10-06 13:34 ` [PATCH v2 1/5] kernel/locking: Use struct qrwlock instead of struct __qrwlock Will Deacon
2017-10-06 13:34   ` Will Deacon
2017-10-06 13:34 ` [PATCH v2 2/5] locking/atomic: Add atomic_cond_read_acquire Will Deacon
2017-10-06 13:34   ` Will Deacon
2017-10-06 13:34 ` [PATCH v2 3/5] kernel/locking: Use atomic_cond_read_acquire when spinning in qrwlock Will Deacon
2017-10-06 13:34   ` Will Deacon
2017-10-08  1:03   ` Boqun Feng
2017-10-08  1:03     ` Boqun Feng
2017-10-09 11:30     ` Will Deacon
2017-10-09 11:30       ` Will Deacon
2017-10-06 13:34 ` [PATCH v2 4/5] arm64: locking: Move rwlock implementation over to qrwlocks Will Deacon
2017-10-06 13:34   ` Will Deacon
2017-10-10  1:34   ` Waiman Long
2017-10-10  1:34     ` Waiman Long
2017-10-11 11:49     ` Will Deacon [this message]
2017-10-11 11:49       ` Will Deacon
2017-10-11 14:03       ` Waiman Long
2017-10-11 14:03         ` Waiman Long
2017-10-06 13:34 ` [PATCH v2 5/5] kernel/locking: Prevent slowpath writers getting held up by fastpath Will Deacon
2017-10-06 13:34   ` Will Deacon
2017-10-08 21:30 ` [PATCH v2 0/5] Switch arm64 over to qrwlock Yury Norov
2017-10-08 21:30   ` Yury Norov
2017-10-09  6:52   ` Peter Zijlstra
2017-10-09  6:52     ` Peter Zijlstra
2017-10-09 10:02     ` Will Deacon
2017-10-09 10:02       ` Will Deacon
2017-10-09  9:59   ` Will Deacon
2017-10-09  9:59     ` Will Deacon
2017-10-09 12:49     ` Yury Norov
2017-10-09 12:49       ` Yury Norov
2017-10-09 13:13       ` Will Deacon
2017-10-09 13:13         ` Will Deacon
2017-10-09 21:19 ` Waiman Long
2017-10-09 21:19   ` Waiman Long
2017-10-09 22:31 ` Jeremy Linton
2017-10-09 22:31   ` Jeremy Linton
2017-10-10 18:20 ` Adam Wallis
2017-10-10 18:20   ` Adam Wallis

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=20171011114905.GA27426@arm.com \
    --to=will.deacon@arm.com \
    --cc=Jeremy.Linton@arm.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.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.