<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib/percpu_counter.c, branch v2.6.32.40</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v2.6.32.40</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v2.6.32.40'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2010-12-09T21:26:37Z</updated>
<entry>
<title>percpu: fix list_head init bug in __percpu_counter_init()</title>
<updated>2010-12-09T21:26:37Z</updated>
<author>
<name>Masanori ITOH</name>
<email>itoumsn@nttdata.co.jp</email>
</author>
<published>2010-10-26T21:21:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9cb6e108516a0ec5373066923249c70786a26562'/>
<id>urn:sha1:9cb6e108516a0ec5373066923249c70786a26562</id>
<content type='text'>
commit 8474b591faf3bb0a1e08a60d21d6baac498f15e4 upstream.

WARNING: at lib/list_debug.c:26 __list_add+0x3f/0x81()
Hardware name: Express5800/B120a [N8400-085]
list_add corruption. next-&gt;prev should be prev (ffffffff81a7ea00), but was dead000000200200. (next=ffff88080b872d58).
Modules linked in: aoe ipt_MASQUERADE iptable_nat nf_nat autofs4 sunrpc bridge 8021q garp stp llc ipv6 cpufreq_ondemand acpi_cpufreq freq_table dm_round_robin dm_multipath kvm_intel kvm uinput lpfc scsi_transport_fc igb ioatdma scsi_tgt i2c_i801 i2c_core dca iTCO_wdt iTCO_vendor_support pcspkr shpchp megaraid_sas [last unloaded: aoe]
Pid: 54, comm: events/3 Tainted: G        W  2.6.34-vanilla1 #1
Call Trace:
[&lt;ffffffff8104bd77&gt;] warn_slowpath_common+0x7c/0x94
[&lt;ffffffff8104bde6&gt;] warn_slowpath_fmt+0x41/0x43
[&lt;ffffffff8120fd2e&gt;] __list_add+0x3f/0x81
[&lt;ffffffff81212a12&gt;] __percpu_counter_init+0x59/0x6b
[&lt;ffffffff810d8499&gt;] bdi_init+0x118/0x17e
[&lt;ffffffff811f2c50&gt;] blk_alloc_queue_node+0x79/0x143
[&lt;ffffffff811f2d2b&gt;] blk_alloc_queue+0x11/0x13
[&lt;ffffffffa02a931d&gt;] aoeblk_gdalloc+0x8e/0x1c9 [aoe]
[&lt;ffffffffa02aa655&gt;] aoecmd_sleepwork+0x25/0xa8 [aoe]
[&lt;ffffffff8106186c&gt;] worker_thread+0x1a9/0x237
[&lt;ffffffffa02aa630&gt;] ? aoecmd_sleepwork+0x0/0xa8 [aoe]
[&lt;ffffffff81065827&gt;] ? autoremove_wake_function+0x0/0x39
[&lt;ffffffff810616c3&gt;] ? worker_thread+0x0/0x237
[&lt;ffffffff810653ad&gt;] kthread+0x7f/0x87
[&lt;ffffffff8100aa24&gt;] kernel_thread_helper+0x4/0x10
[&lt;ffffffff8106532e&gt;] ? kthread+0x0/0x87
[&lt;ffffffff8100aa20&gt;] ? kernel_thread_helper+0x0/0x10

It's because there is no initialization code for a list_head contained in
the struct backing_dev_info under CONFIG_HOTPLUG_CPU, and the bug comes up
when block device drivers calling blk_alloc_queue() are used.  In case of
me, I got them by using aoe.

Signed-off-by: Masanori Itoh &lt;itoumsn@nttdata.co.jp&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2009-01-07T01:10:04Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-01-07T01:10:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f94181da7192f4ed8ccb1b633ea4ce56954df130'/>
<id>urn:sha1:f94181da7192f4ed8ccb1b633ea4ce56954df130</id>
<content type='text'>
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  rcu: fix rcutorture bug
  rcu: eliminate synchronize_rcu_xxx macro
  rcu: make treercu safe for suspend and resume
  rcu: fix rcutree grace-period-latency bug on small systems
  futex: catch certain assymetric (get|put)_futex_key calls
  futex: make futex_(get|put)_key() calls symmetric
  locking, percpu counters: introduce separate lock classes
  swiotlb: clean up EXPORT_SYMBOL usage
  swiotlb: remove unnecessary declaration
  swiotlb: replace architecture-specific swiotlb.h with linux/swiotlb.h
  swiotlb: add support for systems with highmem
  swiotlb: store phys address in io_tlb_orig_addr array
  swiotlb: add hwdev to swiotlb_phys_to_bus() / swiotlb_sg_to_bus()
</content>
</entry>
<entry>
<title>percpu_counter: FBC_BATCH should be a variable</title>
<updated>2009-01-06T23:59:13Z</updated>
<author>
<name>Eric Dumazet</name>
<email>dada1@cosmosbay.com</email>
</author>
<published>2009-01-06T22:41:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=179f7ebff6be45738c6e2fa68c8d2cc5c2c6308e'/>
<id>urn:sha1:179f7ebff6be45738c6e2fa68c8d2cc5c2c6308e</id>
<content type='text'>
For NR_CPUS &gt;= 16 values, FBC_BATCH is 2*NR_CPUS

Considering more and more distros are using high NR_CPUS values, it makes
sense to use a more sensible value for FBC_BATCH, and get rid of NR_CPUS.

A sensible value is 2*num_online_cpus(), with a minimum value of 32 (This
minimum value helps branch prediction in __percpu_counter_add())

We already have a hotcpu notifier, so we can adjust FBC_BATCH dynamically.

We rename FBC_BATCH to percpu_counter_batch since its not a constant
anymore.

Signed-off-by: Eric Dumazet &lt;dada1@cosmosbay.com&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branches 'core/futexes', 'core/locking', 'core/rcu' and 'linus' into core/urgent</title>
<updated>2009-01-06T08:32:11Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2009-01-06T08:32:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fdbc0450df12cc9cb397f3497db4b0cad7c1a8ff'/>
<id>urn:sha1:fdbc0450df12cc9cb397f3497db4b0cad7c1a8ff</id>
<content type='text'>
</content>
</entry>
<entry>
<title>locking, percpu counters: introduce separate lock classes</title>
<updated>2008-12-29T12:43:00Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2008-12-26T14:08:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ea319518ba3de282c13ae1cf4bf2215c5e03e67e'/>
<id>urn:sha1:ea319518ba3de282c13ae1cf4bf2215c5e03e67e</id>
<content type='text'>
Impact: fix lockdep false positives

Classify percpu_counter instances similar to regular lock objects --
that is, per instantiation site.

The networking code has increased its use of percpu_counters, which
leads to false positives if they are treated as a single class.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>revert "percpu_counter: new function percpu_counter_sum_and_set"</title>
<updated>2008-12-10T16:01:52Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2008-12-09T21:14:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=02d211688727ad02bb4555b1aa8ae2de16b21b39'/>
<id>urn:sha1:02d211688727ad02bb4555b1aa8ae2de16b21b39</id>
<content type='text'>
Revert

    commit e8ced39d5e8911c662d4d69a342b9d053eaaac4e
    Author: Mingming Cao &lt;cmm@us.ibm.com&gt;
    Date:   Fri Jul 11 19:27:31 2008 -0400

        percpu_counter: new function percpu_counter_sum_and_set

As described in

	revert "percpu counter: clean up percpu_counter_sum_and_set()"

the new percpu_counter_sum_and_set() is racy against updates to the
cpu-local accumulators on other CPUs.  Revert that change.

This means that ext4 will be slow again.  But correct.

Reported-by: Eric Dumazet &lt;dada1@cosmosbay.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Mingming Cao &lt;cmm@us.ibm.com&gt;
Cc: &lt;linux-ext4@vger.kernel.org&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.27.x]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>revert "percpu counter: clean up percpu_counter_sum_and_set()"</title>
<updated>2008-12-10T16:01:52Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2008-12-09T21:14:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=71c5576fbd809f2015f4eddf72e501e298720cf3'/>
<id>urn:sha1:71c5576fbd809f2015f4eddf72e501e298720cf3</id>
<content type='text'>
Revert

    commit 1f7c14c62ce63805f9574664a6c6de3633d4a354
    Author: Mingming Cao &lt;cmm@us.ibm.com&gt;
    Date:   Thu Oct 9 12:50:59 2008 -0400

        percpu counter: clean up percpu_counter_sum_and_set()

Before this patch we had the following:

percpu_counter_sum(): return the percpu_counter's value

percpu_counter_sum_and_set(): return the percpu_counter's value, copying
that value into the central value and zeroing the per-cpu counters before
returning.

After this patch, percpu_counter_sum_and_set() has gone, and
percpu_counter_sum() gets the old percpu_counter_sum_and_set()
functionality.

Problem is, as Eric points out, the old percpu_counter_sum_and_set()
functionality was racy and wrong.  It zeroes out counters on "other" cpus,
without holding any locks which will prevent races agaist updates from
those other CPUS.

This patch reverts 1f7c14c62ce63805f9574664a6c6de3633d4a354.  This means
that percpu_counter_sum_and_set() still has the race, but
percpu_counter_sum() does not.

Note that this is not a simple revert - ext4 has since started using
percpu_counter_sum() for its dirty_blocks counter as well.

Note that this revert patch changes percpu_counter_sum() semantics.

Before the patch, a call to percpu_counter_sum() will bring the counter's
central counter mostly up-to-date, so a following percpu_counter_read()
will return a close value.

After this patch, a call to percpu_counter_sum() will leave the counter's
central accumulator unaltered, so a subsequent call to
percpu_counter_read() can now return a significantly inaccurate result.

If there is any code in the tree which was introduced after
e8ced39d5e8911c662d4d69a342b9d053eaaac4e was merged, and which depends
upon the new percpu_counter_sum() semantics, that code will break.

Reported-by: Eric Dumazet &lt;dada1@cosmosbay.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Mingming Cao &lt;cmm@us.ibm.com&gt;
Cc: &lt;linux-ext4@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>percpu_counter: fix CPU unplug race in percpu_counter_destroy()</title>
<updated>2008-12-10T16:01:52Z</updated>
<author>
<name>Eric Dumazet</name>
<email>dada1@cosmosbay.com</email>
</author>
<published>2008-12-09T21:14:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fd3d664fef97cf01f8e28fe0b024ad52f3bbc1bc'/>
<id>urn:sha1:fd3d664fef97cf01f8e28fe0b024ad52f3bbc1bc</id>
<content type='text'>
We should first delete the counter from percpu_counters list
before freeing memory, or a percpu_counter_hotcpu_callback()
could dereference a NULL pointer.

Signed-off-by: Eric Dumazet &lt;dada1@cosmosbay.com&gt;
Acked-by: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Mingming Cao &lt;cmm@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>percpu counter: clean up percpu_counter_sum_and_set()</title>
<updated>2008-10-09T16:50:59Z</updated>
<author>
<name>Mingming Cao</name>
<email>cmm@us.ibm.com</email>
</author>
<published>2008-10-09T16:50:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1f7c14c62ce63805f9574664a6c6de3633d4a354'/>
<id>urn:sha1:1f7c14c62ce63805f9574664a6c6de3633d4a354</id>
<content type='text'>
percpu_counter_sum_and_set() and percpu_counter_sum() is the same except
the former updates the global counter after accounting.  Since we are
taking the fbc-&gt;lock to calculate the precise value of the counter in
percpu_counter_sum() anyway, it should simply set fbc-&gt;count too, as the
percpu_counter_sum_and_set() does.

This patch merges these two interfaces into one.
 
Signed-off-by: Mingming Cao &lt;cmm@us.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: &lt;linux-ext4@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>percpu_counter: new function percpu_counter_sum_and_set</title>
<updated>2008-07-11T23:27:31Z</updated>
<author>
<name>Mingming Cao</name>
<email>cmm@us.ibm.com</email>
</author>
<published>2008-07-11T23:27:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e8ced39d5e8911c662d4d69a342b9d053eaaac4e'/>
<id>urn:sha1:e8ced39d5e8911c662d4d69a342b9d053eaaac4e</id>
<content type='text'>
Delayed allocation need to check free blocks at every write time.
percpu_counter_read_positive() is not quit accurate. delayed
allocation need a more accurate accounting, but using
percpu_counter_sum_positive() is frequently is quite expensive.

This patch added a new function to update center counter when sum
per-cpu counter, to increase the accurate rate for next
percpu_counter_read() and require less calling expensive
percpu_counter_sum().

Signed-off-by: Mingming Cao &lt;cmm@us.ibm.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;

</content>
</entry>
</feed>
