RE: [RFC] change non-atomic bitops method

2015-02-09 Thread Wang, Yalin
ger.kernel.org'; 'li...@arm.linux.org.uk'; 'linux-arm- > ker...@lists.infradead.org' > Subject: Re: [RFC] change non-atomic bitops method > > On Mon, 9 Feb 2015 16:18:10 +0800 "Wang, Yalin" > wrote: > > > > That we're running clea

Re: [RFC] change non-atomic bitops method

2015-02-09 Thread Rasmus Villemoes
On Mon, Feb 09 2015, "Wang, Yalin" wrote: > I te-test the patch on 3.10 kernel. > The result like this: > > VmallocChunk: 251498164 kB > __set_bit_miss_count:11730 __set_bit_success_count:1036316 > __clear_bit_miss_count:209640 __clear_bit_success_count:4806556 > __test_and_set_bit_miss_count:0

Re: [RFC] change non-atomic bitops method

2015-02-09 Thread Andrew Morton
On Mon, 9 Feb 2015 16:18:10 +0800 "Wang, Yalin" wrote: > > That we're running clear_bit against a cleared bit 10% of the time is a > > bit alarming. I wonder where that's coming from. > > > > The enormous miss count in test_and_clear_bit() might indicate an > > inefficiency somewhere. > I te-t

RE: [RFC] change non-atomic bitops method

2015-02-09 Thread Wang, Yalin
ger.kernel.org'; 'li...@arm.linux.org.uk'; 'linux-arm- > ker...@lists.infradead.org' > Subject: Re: [RFC] change non-atomic bitops method > > On Tue, 3 Feb 2015 16:42:14 +0800 "Wang, Yalin" > wrote: > > > I make a change in kernel to test hit/m

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread Uwe Kleine-König
Hello, [added some more context again] On Tue, Feb 03, 2015 at 03:14:43PM +, David Howells wrote: > > > - *p |= mask; > > > + if ((*p & mask) == 0) > > > + *p |= mask; > > Care to fix the double space here while touching the code? > > > > I think the more natural check

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread David Howells
Uwe Kleine-König wrote: > Might be a matter of taste, but this check is equivalent to > > *p != (*p | mask) > > which is what you really want to test for. I would argue that this is less clear as to what's going on. David -- To unsubscribe from this list: send the line "unsubscribe linu

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread Andrew Morton
On Tue, 3 Feb 2015 16:42:14 +0800 "Wang, Yalin" wrote: > I make a change in kernel to test hit/miss ratio: Neat, thanks. > > ... > > After use the phone some time: > root@D5303:/ # cat /proc/meminfo > VmallocUsed: 10348 kB > VmallocChunk: 75632 kB > __set_bit_miss_count:10002 __set_

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread Kirill A. Shutemov
On Tue, Feb 03, 2015 at 03:17:30AM +0200, Kirill A. Shutemov wrote: > Results for 10 runs on my laptop -- i5-3427U (IvyBridge 1.8 Ghz, 2.8Ghz Turbo > with 3MB LLC): I've screwed up the inner loop condition and step. As result the benchmark touches the same cache line 8 times and scan SIZE/8 of mem

RE: [RFC] change non-atomic bitops method

2015-02-03 Thread Wang, Yalin
org'; 'linux-kernel@vger.kernel.org'; > 'li...@arm.linux.org.uk'; 'linux-arm-ker...@lists.infradead.org' > Subject: Re: [RFC] change non-atomic bitops method > > On Tue, Feb 03 2015, Andrew Morton wrote: > > > > > You aren't measuring the right

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread Rasmus Villemoes
On Tue, Feb 03 2015, Andrew Morton wrote: > > You aren't measuring the right thing. You should compare > > if (p[i] != x) > p[i] = x; > > versus > > p[i] = x; > > and you should do this for two cases: > > a) p[i] == x > > b) p[i] != x > > > The first code sequence will

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread Andrew Morton
On Tue, 03 Feb 2015 00:40:31 -0800 (PST) David Miller wrote: > From: Andrew Morton > Date: Mon, 2 Feb 2015 22:38:51 -0800 > > > It is only with both these ratios that we can work out whether the > > patch is a net gain. My suspicion is that set_bit on an already-set > > bit is so rare that th

RE: [RFC] change non-atomic bitops method

2015-02-03 Thread Wang, Yalin
; 'li...@arm.linux.org.uk'; 'linux-arm- > ker...@lists.infradead.org' > Subject: RE: [RFC] change non-atomic bitops method > > > -Original Message- > > From: Andrew Morton [mailto:a...@linux-foundation.org] > > Sent: Tuesday, February 03, 2015 2:39 PM

Re: [RFC] change non-atomic bitops method

2015-02-03 Thread David Miller
From: Andrew Morton Date: Mon, 2 Feb 2015 22:38:51 -0800 > It is only with both these ratios that we can work out whether the > patch is a net gain. My suspicion is that set_bit on an already-set > bit is so rare that the patch will be a loss. A common pattern is implementing a "referenced" bit

RE: [RFC] change non-atomic bitops method

2015-02-02 Thread Wang, Yalin
ger.kernel.org'; 'li...@arm.linux.org.uk'; 'linux-arm- > ker...@lists.infradead.org' > Subject: Re: [RFC] change non-atomic bitops method > > On Tue, 3 Feb 2015 13:42:45 +0800 "Wang, Yalin" > wrote: > > > > ... > > > > #ifdef CHE

Re: [RFC] change non-atomic bitops method

2015-02-02 Thread Andrew Morton
On Tue, 3 Feb 2015 13:42:45 +0800 "Wang, Yalin" wrote: > > ... > > #ifdef CHECK_BEFORE_SET > if (p[i] != times) > #endif > > ... > > > One run on CPU0, reader thread run on CPU1, > Test result: > sudo ./cache_test > reader:8.426228173 > 8.672198335 > > With -DCHECK_BEF

RE: [RFC] change non-atomic bitops method

2015-02-02 Thread Wang, Yalin
...@arm.linux.org.uk'; 'linux-arm- > ker...@lists.infradead.org' > Subject: RE: [RFC] change non-atomic bitops method > > > -Original Message- > > From: Kirill A. Shutemov [mailto:kir...@shutemov.name] > > Sent: Tuesday, February 03, 2015 9:18 AM

RE: [RFC] change non-atomic bitops method

2015-02-02 Thread Wang, Yalin
27;; 'li...@arm.linux.org.uk'; 'linux-arm- > ker...@lists.infradead.org' > Subject: Re: [RFC] change non-atomic bitops method > > On Mon, Feb 02, 2015 at 03:29:09PM -0800, Andrew Morton wrote: > > On Mon, 2 Feb 2015 11:55:03 +0800 "Wang, Yalin" > wrot

Re: [RFC] change non-atomic bitops method

2015-02-02 Thread Kirill A. Shutemov
On Mon, Feb 02, 2015 at 03:29:09PM -0800, Andrew Morton wrote: > On Mon, 2 Feb 2015 11:55:03 +0800 "Wang, Yalin" > wrote: > > > This patch change non-atomic bitops, > > add a if() condition to test it, before set/clear the bit. > > so that we don't need dirty the cache line, if this bit > > have

Re: [RFC] change non-atomic bitops method

2015-02-02 Thread Russell King - ARM Linux
On Mon, Feb 02, 2015 at 03:29:09PM -0800, Andrew Morton wrote: > On Mon, 2 Feb 2015 11:55:03 +0800 "Wang, Yalin" > wrote: > > > This patch change non-atomic bitops, > > add a if() condition to test it, before set/clear the bit. > > so that we don't need dirty the cache line, if this bit > > have

Re: [RFC] change non-atomic bitops method

2015-02-02 Thread Andrew Morton
On Mon, 2 Feb 2015 11:55:03 +0800 "Wang, Yalin" wrote: > This patch change non-atomic bitops, > add a if() condition to test it, before set/clear the bit. > so that we don't need dirty the cache line, if this bit > have been set or clear. On SMP system, dirty cache line will > need invalidate ot

Re: [RFC] change non-atomic bitops method

2015-02-02 Thread Uwe Kleine-König
On Mon, Feb 02, 2015 at 11:55:03AM +0800, Wang, Yalin wrote: > This patch change non-atomic bitops, > add a if() condition to test it, before set/clear the bit. > so that we don't need dirty the cache line, if this bit > have been set or clear. On SMP system, dirty cache line will > need invalidate

Re: [RFC] change non-atomic bitops method

2015-02-02 Thread Laura Abbott
On 2/1/2015 7:55 PM, Wang, Yalin wrote: This patch change non-atomic bitops, add a if() condition to test it, before set/clear the bit. so that we don't need dirty the cache line, if this bit have been set or clear. On SMP system, dirty cache line will need invalidate other processors cache line,