From: Eric Dumazet <eric.dumazet@gmail.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
tj@kernel.org, cl@linux.com
Subject: Re: [patch v3 2/3] percpu_counter: use atomic64 for counter in SMP
Date: Tue, 17 May 2011 11:02:32 +0200 [thread overview]
Message-ID: <1305622952.2850.23.camel@edumazet-laptop> (raw)
In-Reply-To: <20110517084419.602635499@sli10-conroe.sh.intel.com>
Le mardi 17 mai 2011 à 16:41 +0800, Shaohua Li a écrit :
> pièce jointe document texte brut (percpu-counter-atomic.patch)
> Uses atomic64 for percpu_counter, because it is cheaper than spinlock.
> This doesn't slow fast path (percpu_counter_read). atomic64_read
> equals to read fbc->count for 64-bit system, or equals to
> spin_lock-read-spin_unlock for 32-bit system. Note, originally
> the percpu_counter_read for 32-bit system doesn't hold spin_lock,
> but that is buggy and might cause very wrong value accessed. This
> patch fixes the issue.
>
> We use sum_start and add_start to make sure _sum doesn't see deviation
> when _add slow path is running. When _sum is running, _add will wait
> _sum finish. This is scaring that _add is slow down, but actually not,
> because _sum is called very rare. We could make _sum waits _add finish,
> but since _add is called frequently, this will make _sum run very slow.
>
> This can also improve some workloads with percpu_counter->lock heavily
> contented. For example, vm_committed_as sometimes causes the contention.
> We should tune the batch count, but if we can make percpu_counter better,
> why not? In a 24 CPUs system and 24 processes, each runs:
> while (1) {
> mmap(128M);
> munmap(128M);
> }
> we then measure how many loops each process can take:
> The atomic method gives 4x faster.
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> --
I NACK this patch, its not necessary, since percpu_counter doesnt
provide a precise count api anyway.
Please resubmit your original patches, without the bloat.
Thanks
next prev parent reply other threads:[~2011-05-17 9:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 8:41 [patch v3 0/3] percpu_counter: bug fix and enhancement Shaohua Li
2011-05-17 8:41 ` [patch v3 1/3] percpu_counter: fix code for 32bit systems for UP Shaohua Li
2011-05-17 8:41 ` [patch v3 2/3] percpu_counter: use atomic64 for counter in SMP Shaohua Li
2011-05-17 9:02 ` Eric Dumazet [this message]
2011-05-17 8:41 ` [patch v3 3/3] percpu_counter: use percpu data to track add start Shaohua Li
2011-05-17 8:59 ` Eric Dumazet
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=1305622952.2850.23.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shaohua.li@intel.com \
--cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox