All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Hugh Dickins <hughd@google.com>,
	yanmin.zhang@intel.com
Subject: Re: [PATCH v3 2/2] tmpfs: Make tmpfs scalable with percpu_counter for used blocks
Date: Mon, 21 Jun 2010 13:18:02 -0700	[thread overview]
Message-ID: <20100621131802.c2f45c82.akpm@linux-foundation.org> (raw)
In-Reply-To: <1276818993.9661.82.camel@schen9-DESK>

On Thu, 17 Jun 2010 16:56:33 -0700
Tim Chen <tim.c.chen@linux.intel.com> wrote:

> The current implementation of tmpfs is not scalable.
> We found that stat_lock is contended by multiple threads
> when we need to get a new page, leading to useless spinning
> inside this spin lock.  
> 
> This patch makes use of the percpu_counter library to maintain local
> count of used blocks to speed up getting and returning
> of pages.  So the acquisition of stat_lock is unnecessary
> for getting and returning blocks, improving the performance 
> of tmpfs on system with large number of cpus.  On a 4 socket
> 32 core NHM-EX system, we saw improvement of 270%.

So it had exactly the same performance as the token-jar approach?

It'd be good if the changelog were to mention the inaccuracy issues. 
Describe their impact, if any.

Are you actually happy with this overall approach?

>
> ...
>
> @@ -2258,9 +2254,8 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
>  		return error;
>  
>  	spin_lock(&sbinfo->stat_lock);
> -	blocks = sbinfo->max_blocks - sbinfo->free_blocks;
>  	inodes = sbinfo->max_inodes - sbinfo->free_inodes;
> -	if (config.max_blocks < blocks)
> +	if (config.max_blocks < percpu_counter_sum(&sbinfo->used_blocks))

This could actually use percpu_counter_compare()?

>  		goto out;
>  	if (config.max_inodes < inodes)
>  		goto out;


  parent reply	other threads:[~2010-06-21 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17 23:56 [PATCH v3 2/2] tmpfs: Make tmpfs scalable with percpu_counter for used blocks Tim Chen
2010-06-18  1:35 ` Minchan Kim
2010-06-18  4:08   ` Andrew Morton
2010-06-20 14:28     ` Minchan Kim
2010-06-21 20:18 ` Andrew Morton [this message]
2010-06-22  2:52   ` Tim Chen
2010-06-22 16:52   ` Tim Chen

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=20100621131802.c2f45c82.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ak@linux.intel.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=yanmin.zhang@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 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.