public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm/fault: Put pgd_lock in its own cacheline
@ 2015-06-10 13:08 Waiman Long
  2015-06-11 13:41 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Waiman Long @ 2015-06-10 13:08 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86
  Cc: linux-kernel, Scott J Norton, Douglas Hatch, Waiman Long

On a large system with many cores, massive creation or destruction
of processes/threads can sometime cause a fair amount of spinlock
contention in the pgd_lock used by the pgd_alloc() and pgd_free()
functions. This patch tries to reduce false cacheline sharing by
putting the pgd_lock in its own cacheline which help to reduce
contention on the lock.

Signed-off-by: Waiman Long <Waiman.Long@hp.com>
---
 arch/x86/mm/fault.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 181c53b..fae48df 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -185,7 +185,7 @@ force_sig_info_fault(int si_signo, int si_code, unsigned long address,
 	force_sig_info(si_signo, &info, tsk);
 }
 
-DEFINE_SPINLOCK(pgd_lock);
+__cacheline_aligned_in_smp DEFINE_SPINLOCK(pgd_lock);
 LIST_HEAD(pgd_list);
 
 #ifdef CONFIG_X86_32
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/mm/fault: Put pgd_lock in its own cacheline
  2015-06-10 13:08 [PATCH] x86/mm/fault: Put pgd_lock in its own cacheline Waiman Long
@ 2015-06-11 13:41 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2015-06-11 13:41 UTC (permalink / raw)
  To: Waiman Long
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-kernel,
	Scott J Norton, Douglas Hatch, Linus Torvalds, Andrew Morton,
	Peter Zijlstra, Borislav Petkov


* Waiman Long <Waiman.Long@hp.com> wrote:

> On a large system with many cores, massive creation or destruction
> of processes/threads can sometime cause a fair amount of spinlock
> contention in the pgd_lock used by the pgd_alloc() and pgd_free()
> functions. This patch tries to reduce false cacheline sharing by
> putting the pgd_lock in its own cacheline which help to reduce
> contention on the lock.
> 
> Signed-off-by: Waiman Long <Waiman.Long@hp.com>
> ---
>  arch/x86/mm/fault.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 181c53b..fae48df 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -185,7 +185,7 @@ force_sig_info_fault(int si_signo, int si_code, unsigned long address,
>  	force_sig_info(si_signo, &info, tsk);
>  }
>  
> -DEFINE_SPINLOCK(pgd_lock);
> +__cacheline_aligned_in_smp DEFINE_SPINLOCK(pgd_lock);
>  LIST_HEAD(pgd_list);

Yeah, so if you are seeing pgd_lock contention we could do a lot more to improve 
the performance of pgd allocation than just putting it on a separate cacheline: we 
can actually eliminate pgd_list and turn all pgd_list users into RCU walkers of 
the tasklist lock, and make pgd_alloc()/pgd_free() lockless on x86.

I've done a series that implements this, I'll post it soon, please stay tuned!

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-11 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 13:08 [PATCH] x86/mm/fault: Put pgd_lock in its own cacheline Waiman Long
2015-06-11 13:41 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox