Re: [patch 2/2] backport of sba sg list management to ccio-dma

"Joel Soete" <[email protected]> Thu, 25 Oct 2007 09:13:18 +0200
Newsgroups gmane.linux.ports.hppa
Message-ID <[email protected]>
--_=__=_XaM3_.1193296398.2A.251671.42.16700.52.42.007.837563787
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

> On Tue, Oct 23, 2007 at 06:15:34PM +0200, Joel Soete wrote:
> ...
> > This seems to be better fls then ffs like:
> > int get_iovp_order_faster(unsigned long size)
> > {
> > 	return fls((size - 1) >> (IOVP_SHIFT));
> > }
> 
> Yes, I didn't really think about fls() vs ffs().
> But you figured it out. :)
> 
> I just wanted the asm() version that's 10x faster than looping through
> and testing each bit.
> 
I attached 2 test files (GetOrder-o.c using the original kernel get_iovp_=
order
 routine and GetOrder-f.c using supposed faster release) and here are som=
e
results:
# gcc -O2 -o GetOrder-o GetOrder-o.c 
# gcc -O2 -o GetOrder-f GetOrder-f.c 

# time ./GetOrder-o

real    0m40.576s
user    0m39.990s
sys     0m0.004s

# time ./GetOrder-f

real    0m1.401s
user    0m1.348s
sys     0m0.008s

# gcc -o GetOrder-o GetOrder-o.c 
# gcc -o GetOrder-f GetOrder-f.c 

# time ./GetOrder-o

real    4m54.438s
user    4m48.486s
sys     0m0.044s

# time ./GetOrder-f

real    1m22.989s
user    1m21.317s
sys     0m0.016s

I didn't check in more details the difference of results between not-opti=
mized
and optimized (-O2) compile but it's clear it's faster ;-)

(why not push this in upstream? [I mean ./include/asm-generic/page.h])

> 
> > Even thought following test seems to be ok:
> > 	unsigned int a;
> > 	unsigned long ul;
> > 
> > 	/* for proof of concept
> > 	*/
> > 	for (ul=3D0; ul<536870914; ul++) {
> > 		if ( get_iovp_order(ul) !=3D get_iovp_order_faster(ul) ) {
> > 			printf("get_iovp_order(%ld) =3D %ld (0x%x)\n\n", ul, a =3D
get_iovp_order(ul), a);
> > 			printf("get_iovp_order_faster(%ld) =3D %ld (0x%x)\n\n", ul, a =3D
> > get_iovp_order_faster(ul), a);
> > 			exit (1);
> > 		}
> > 	}
> > 
> > But what would give the kernel generic (include/asm-generic/page.h: t=
his is
> > what get_iovp_order() is if IOVP_SHIFT=3D=3DPAGE_SHIFT) get_order(0):=
 0?
> > the answer is 20 for paric and ia32?
> 
> I don't know offhand.
> I'm not sure we have to handle that case...or if we do, make sure it's
handled correctly in get_iovp_order().
> 
I just hope so that linux check to never call get_order(0) ;-)

> > > ...
> > > +#ifdef CCIO_MAP_STATS
> > > +		ioc->usg_pages +=3D sg_dma_len(sglist) >> IOVP_SHIFT;
> > > +		ioc->usingle_calls--;   /* kluge since call is unmap_sg() */
> > > +#endif
> > >
> > > I wouldn't add MAP_STATS here.
> > > They aren't enabled in SBA becuase they impact performance too much=
.
> > > I expect that will always be true and would seriously consider remo=
ving
> > > MAP_STATS code from SBA as well. Timing the bitmap search is
> > > probably the only critical bit of info that really matters.
> > > And that's for developement/testing only.
> > >
> > mmm, I would so let stay here but with just additional comment to pre=
vent to
> > activate it outside this development/testing context?
> 
> That's fine too.

In fact it would be useless as the begining of the src this #define was
already commented this way ;-)
 
> Just making a suggestion here since stats are alot less
> useful when stats interfere with the actual performance measurements.
> Reducing the stats only measuring the search time would make more sense=

> to me.
> 
understand. (I will remove this too so, even thought tbh I didn't yet tes=
t
this feature)

> cheers,
> grant
> 
> 
Many tx,
    J.

PS: I play a bit with this stuff and surprisingly with latest git grab of=

2.6.23, the narrow s-e disk (on LASI ncr53c710 hba) seems to be usable: I=

reach to update an debian unstable installation not updated since a year
(about 430 upgrade) with just few and harmless "Bus Reset ..." and "faili=
ng
command because of reset, ..." =0A---=0APack Scarlet One, ADSL 6 Mbps + T=
elephonie, a partir de EUR 29,95...=0Ahttp://www.scarlet.be/
--_=__=_XaM3_.1193296398.2A.251671.42.16700.52.42.007.837563787
Content-Type: application/octet-stream;
	name="=?iso-8859-1?Q?GetOrder-o.c?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="=?iso-8859-1?Q?GetOr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B1bDsKCgkv
KiBmb3IgcHJvb2Ygb2YgY29uY2VwdAoJZm9yICh1bD0wOyB1bDxVTE9OR19NQVg7IHVsKysp
IHsKCQlpZiAoIGdldF9vcmRlcih1bCkgIT0gZ2V0X2lvdnBfb3JkZXIodWwpICkgewoJCQlw
cmludGYoImdldF9vcmRlciglbGQpID0gJWxkICgweCV4KVxuXG4iLCB1bCwgYSA9IGdldF9v
cmRlcih1bCksIGEpOwoJCQlwcmludGYoImdldF9pb3ZwX29yZGVyKCVsZCkgPSAlbGQgKDB4
JXgpXG5cbiIsIHVsLCBhID0gZ2V0X2lvdnBfb3JkZXIodWwpLCBhKTsKCQkJZXhpdCAoMSk7
CgkJfQoJfQoJKi8KCgkvKiBmb3IgcHVyZSB0aW1lIGNoZWNrCgkqLwoJZm9yICh1bD0wOyB1
bDw1MzY4NzA5MTQ7IHVsKyspCgkJZ2V0X2lvdnBfb3JkZXIodWwpOwoKCXJldHVybiAwOwp9
CgovKgoMCiovIAo=

--_=__=_XaM3_.1193296398.2A.251671.42.16700.52.42.007.837563787
Content-Type: application/octet-stream;
	name="=?iso-8859-1?Q?GetOrder-f.c?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="=?iso-8859-1?Q?GetOrder-f.c?="

I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0cmlu
Zy5oPgojaW5jbHVkZSA8ZXJybm8uaD4KCgojZGVmaW5lIFBBR0VfU0hJRlQJMTIKI2RlZmlu
ZSBQQUdFX1NJWkUJKDFVTCA8PCBQQUdFX1NISUZUKQojZGVmaW5lIFBBR0VfTUFTSwkofihQ
QUdFX1NJWkUtMSkpCgojZGVmaW5lIElPVlBfU0hJRlQgICAgICBQQUdFX1NISUZUKzMKI2Rl
ZmluZSBJT1ZQX1NJWkUgICAgICAgKDFVTCA8PCBJT1ZQX1NISUZUKQojZGVmaW5lIElPVlBf
TUFTSyAgICAgICAofihJT1Z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KCQk6ICIrciIgKHgpLCAiPXIi
IChyZXQpICk7CgoJcmV0dXJuIHJldDsKfQoKc3RhdGljIF9faW5saW5lX18KaW50IGdldF9p
b3ZwX29yZGVyX2Zhc3Rlcih1bnNpZ25lZCBsb25nIHNpemUpCnsKCXJldHVybiBmbHMoKHNp
emUgLSAxKSA+PiAoSU9WUF9TSElGVCkpOwp9CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAq
ICogYXJndiwgY2hhciAqICogZW52KSB7CgoJdW5zaWduZWQgaW50IGE7Cgl1bnNpZ25lZCBs
b25nIHVsOwoKCS8qIGZvciBwcm9vZiBvZiBjb25jZXB0Cglmb3IgKHVsPTA7IHVsPFVMT05H
X01BWDsgdWwrKykgewoJCWlmICggZ2V0X2lvdnBfb3JkZXIodWwpICE9IGdldF9pb3ZwX29y
ZGVyX2Zhc3Rlcih1bCkgKSB7CgkJCXByaW50ZigiZ2V0X2lvdnBfb3JkZXIoJWxkKSA9ICVs
ZCAoMHgleClcblxuIiwgdWwsIGEgPSBnZXRfaW92cF9vcmRlcih1bCksIGEpOwoJCQlwcmlu
dGYoImdldF9pb3ZwX29yZGVyX2Zhc3RlciglbGQpID0gJWxkICgweCV4KVxuXG4iLCB1bCwg
YSA9IGdldF9pb3ZwX29yZGVyX2Zhc3Rlcih1bCksIGEpOwoJCQlleGl0ICgxKTsKCQl9Cgl9
CgkqLwoKCS8qIGZvciBwdXJlIHRpbWUgY2hlY2sKCSovCglmb3IgKHVsPTA7IHVsPDUzNjg3
MDkxNDsgdWwrKykgCgkJZ2V0X2lvdnBfb3JkZXJfZmFzdGVyKHVsKTsKCglyZXR1cm4gMDsK
fQoK

--_=__=_XaM3_.1193296398.2A.251671.42.16700.52.42.007.837563787
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
--_=__=_XaM3_.1193296398.2A.251671.42.16700.52.42.007.837563787--