public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ShuoX Liu <shuox.liu@intel.com>
To: Tejun Heo <tj@kernel.org>
Cc: Yanmin Zhang <yanmin_zhang@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] percpu, x86: don't use PMD_SIZE as embedded atom_size on 32bit
Date: Sat, 28 Apr 2012 10:18:47 +0800	[thread overview]
Message-ID: <4F9B5387.8030002@intel.com> (raw)
In-Reply-To: <20120427165356.GA26595@google.com>

On 2012年04月28日 00:53, Tejun Heo wrote:

> With the embed percpu first chunk allocator, x86 uses either PAGE_SIZE
> or PMD_SIZE for atom_size.  PMD_SIZE is used when CPU supports PSE so
> that percpu areas are aligned to PMD mappings and possibly allow using
> PMD mappings in vmalloc areas in the future.  Using larger atom_size
> doesn't waste actual memory; however, it does require larger vmalloc
> space allocation later on for !first chunks.
> 
> With reasonably sized vmalloc area, PMD_SIZE shouldn't be a problem
> but x86_32 at this point is anything but reasonable in terms of
> address space and using later atom_size reportedly leads to frequent
> percpu allocation failures on certain setups.
> 
> This patch makes x86_32 always use PAGE_SIZE as atom_size for embed
> first chunk allocator.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-by: Yanmin Zhang <yanmin.zhang@intel.com>
> Reported-by: ShuoX Liu <shuox.liu@intel.com>
> LKML-Reference: <4F97BA98.6010001@intel.com>
> Cc: stable@vger.kernel.org
> ---
> Can you please verify this resolves the issue you guys are seeing?
> Once verified, I'll push it through percpu/for-3.5-fixes.
> 

Verify OK.

> Thanks.
> 
>  arch/x86/kernel/setup_percpu.c |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
> index 71f4727..ed96573 100644
> --- a/arch/x86/kernel/setup_percpu.c
> +++ b/arch/x86/kernel/setup_percpu.c
> @@ -185,10 +185,22 @@ void __init setup_per_cpu_areas(void)
>  #endif
>  	rc = -EINVAL;
>  	if (pcpu_chosen_fc != PCPU_FC_PAGE) {
> -		const size_t atom_size = cpu_has_pse ? PMD_SIZE : PAGE_SIZE;
>  		const size_t dyn_size = PERCPU_MODULE_RESERVE +
>  			PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE;
> +		size_t atom_size;
>  
> +		/*
> +		 * If PSE is available, use PMD_SIZE for atom_size so that
> +		 * embedded percpu areas are aligned to PMD.  This, in the
> +		 * future, can also allow using PMD mappings in vmalloc
> +		 * area.  Use PAGE_SIZE on 32bit as vmalloc space is highly
> +		 * contended and large vmalloc area alloc can easily fail.
> +		 */
> +		atom_size = PAGE_SIZE;
> +#ifdef CONFIG_X86_64
> +		if (cpu_has_pse)
> +			atom_size = PMD_SIZE;
> +#endif
>  		rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE,
>  					    dyn_size, atom_size,
>  					    pcpu_cpu_distance,



  parent reply	other threads:[~2012-04-28  2:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25  8:49 [PATCH] mm: percpu: Add PCPU_FC_FIXED to pcpu_fc for setting fixed pcpu_atom_size ShuoX Liu
2012-04-25 22:24 ` Tejun Heo
2012-04-26  2:01   ` Yanmin Zhang
2012-04-26 22:49     ` Tejun Heo
2012-04-27  1:09       ` Yanmin Zhang
2012-04-27  8:56         ` Yanmin Zhang
2012-04-27 16:53           ` [PATCH] percpu, x86: don't use PMD_SIZE as embedded atom_size on 32bit Tejun Heo
2012-04-27 17:17             ` H. Peter Anvin
2012-04-27 17:27               ` Tejun Heo
2012-04-27 17:21             ` Christoph Lameter
2012-04-27 17:27               ` Tejun Heo
2012-04-27 17:39             ` [PATCH v2] " Tejun Heo
2012-04-27 17:51               ` H. Peter Anvin
2012-04-27 17:53                 ` Tejun Heo
2012-04-28  2:18             ` ShuoX Liu [this message]
2012-04-27 16:34         ` [PATCH] mm: percpu: Add PCPU_FC_FIXED to pcpu_fc for setting fixed pcpu_atom_size Tejun Heo

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=4F9B5387.8030002@intel.com \
    --to=shuox.liu@intel.com \
    --cc=cl@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=yanmin_zhang@linux.intel.com \
    /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