linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch v2 0/5] percpu_counter: bug fix and enhancement
@ 2011-05-11  8:10 Shaohua Li
  2011-05-11  8:10 ` [patch v2 1/5] percpu_counter: fix code for 32bit systems for UP Shaohua Li
                   ` (5 more replies)
  0 siblings, 6 replies; 52+ messages in thread
From: Shaohua Li @ 2011-05-11  8:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, tj, eric.dumazet, cl, npiggin

The patch sets do two things.
1. fix bug for 32-bit system. percpu_counter uses s64 counter. Without any
locking reading s64 in 32-bit system isn't safe and can cause bad side effect.
2. improve scalability for __percpu_counter_add. In some cases, _add could
cause heavy lock contention (see patch 4 for detailed infomation and data).
The patches will remove the contention and speed up it a bit. Last post
(http://marc.info/?l=linux-kernel&m=130259547913607&w=2) simpliy uses
atomic64 for percpu_counter, but Tejun pointed out this could cause
deviation in __percpu_counter_sum.
The new implementation uses lglock to protect percpu data. Each cpu has its
private lock while other cpu doesn't take. In this way _add doesn't need take
global lock anymore and remove the deviation. This still gives me about
about 5x ~ 6x faster (not that faster than the original 7x faster, but still
good) with the workload mentioned in patch 4.

patch 1 fix s64 read bug for 32-bit system for UP
patch 2 convert lglock to be used by dynamaically allocated structre. Later
patch will use lglock for percpu_counter
patch 3,4 fix s64 read bug for 32-bit system for MP. And it also improve the
scalability for __percpu_counter_add.
patch 5 is from Christoph Lameter to make __percpu_counter_add fastpath
preemptless. I added it here because I converted percpu_counter to use
lglock. All bugs are from mine.

Comments and suggestions are welcomed!

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2011-05-18  1:00 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-11  8:10 [patch v2 0/5] percpu_counter: bug fix and enhancement Shaohua Li
2011-05-11  8:10 ` [patch v2 1/5] percpu_counter: fix code for 32bit systems for UP Shaohua Li
2011-05-11  8:10 ` [patch v2 2/5] lglock: convert it to work with dynamically allocated structure Shaohua Li
2011-05-11  8:10 ` [patch v2 3/5] percpu_counter: use lglock to protect percpu data Shaohua Li
2011-05-11  8:10 ` [patch v2 4/5] percpu_counter: use atomic64 for counter in SMP Shaohua Li
2011-05-11  9:34   ` Andrew Morton
2011-05-12  2:40     ` Shaohua Li
2011-05-11  8:10 ` [patch v2 5/5] percpu_counter: preemptless __per_cpu_counter_add Shaohua Li
2011-05-11  9:28 ` [patch v2 0/5] percpu_counter: bug fix and enhancement Tejun Heo
2011-05-12  2:48   ` Shaohua Li
2011-05-12  8:21     ` Tejun Heo
2011-05-12  8:55       ` Shaohua Li
2011-05-12  8:59         ` Tejun Heo
2011-05-12  9:02           ` Eric Dumazet
2011-05-12  9:03             ` Eric Dumazet
2011-05-12  9:05             ` Tejun Heo
2011-05-13  3:09               ` Shaohua Li
2011-05-13  4:37               ` Shaohua Li
2011-05-13  5:20                 ` Eric Dumazet
2011-05-13  5:28                   ` Shaohua Li
2011-05-13  6:34                     ` Eric Dumazet
2011-05-13  7:33                       ` Shaohua Li
2011-05-13 14:51                       ` [patch] percpu_counter: scalability works Eric Dumazet
2011-05-13 15:39                         ` Eric Dumazet
2011-05-13 16:35                           ` [patch V2] " Eric Dumazet
2011-05-13 16:46                             ` Eric Dumazet
2011-05-13 22:03                               ` [patch V3] " Eric Dumazet
2011-05-16  0:58                                 ` Shaohua Li
2011-05-16  6:11                                   ` Eric Dumazet
2011-05-16  6:37                                     ` Shaohua Li
2011-05-16  6:55                                       ` Eric Dumazet
2011-05-16  7:15                                         ` Shaohua Li
2011-05-16  7:44                                           ` Eric Dumazet
2011-05-16  8:34                                             ` Shaohua Li
2011-05-16  9:35                                               ` Eric Dumazet
2011-05-16 14:22                                                 ` Eric Dumazet
2011-05-17  0:55                                                   ` Shaohua Li
2011-05-17  4:56                                                     ` Eric Dumazet
2011-05-17  5:22                                                       ` Shaohua Li
2011-05-17  9:01                                                         ` Eric Dumazet
2011-05-17  9:11                                                           ` Tejun Heo
2011-05-17  9:45                                                             ` Eric Dumazet
2011-05-17  9:50                                                               ` Tejun Heo
2011-05-17 12:20                                                                 ` Eric Dumazet
2011-05-17 12:45                                                                   ` Tejun Heo
2011-05-17 13:00                                                                     ` Eric Dumazet
2011-05-17 13:04                                                                       ` Tejun Heo
2011-05-17 13:55                                                                         ` Christoph Lameter
2011-05-17 14:02                                                                           ` Tejun Heo
2011-05-17 14:38                                                                             ` Christoph Lameter
2011-05-18  1:00                                                                 ` Shaohua Li
2011-05-12 14:38   ` [patch v2 0/5] percpu_counter: bug fix and enhancement Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).