public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>,
	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: Sun, 20 Jun 2010 23:28:42 +0900	[thread overview]
Message-ID: <20100620142842.GA2369@barrios-desktop> (raw)
In-Reply-To: <20100617210859.40e024a1.akpm@linux-foundation.org>

On Thu, Jun 17, 2010 at 09:08:59PM -0700, Andrew Morton wrote:
> On Fri, 18 Jun 2010 10:35:51 +0900 Minchan Kim <minchan.kim@gmail.com> wrote:
> 
> > > __struct shmem_sb_info {
> > > __ __ __ __unsigned long max_blocks; __ /* How many blocks are allowed */
> > > - __ __ __ unsigned long free_blocks; __/* How many are left for allocation */
> > > + __ __ __ struct percpu_counter used_blocks; __/* How many are allocated */
> > 
> > Just a nitpick.
> > Why do you change free_blocks and used_blocks?
> > I think we can use free_blocks following as.
> > 
> > ex)
> > if (percpu_counter_compare(&sbinfo->free_blocks, 0))
> 
> See previous lengthy discussion ;)
> 
> If we count free_blocks then we need to alter the value of free_blocks
> in remount_fs, and reinitialising distributed counters on-the-fly is
> ugly.
> 
> I suppose we could have done it by doing a large add or sub in
> remount_fs, and keeping track of the exact value of free_blocks
> elsewhere in the superblock, but it's far simpler this way.
> 

Thanks, Andrew. I found your comment in previous mail thread. 
Tim, Please add below Andrew's comment in description. 

It would make reviewer happy in future.

--
Andrew's comment
" It a bit buggy - using percpu_counter_init() against an
already-initialised percpu_counter() is leaky.  I suspect that's
happening in remount_fs.

A better approach would be to remove free_blocks altogether and add a
new `percpu_counter used_blocks;' which simply counts how many blocks
are presently in use.  Such a thing would then never need to be
reinitialised."


-- 
Kind regards,
Minchan Kim

  reply	other threads:[~2010-06-20 14:28 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 [this message]
2010-06-21 20:18 ` Andrew Morton
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=20100620142842.GA2369@barrios-desktop \
    --to=minchan.kim@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox