I have doubts it will works: - item = bucket->ub_bucket[--bucket->ub_cnt]; - 1bbe: 66 ff 49 08 decw 0x8(%ecx) - 1bc2: 0f bf 41 08 movswl 0x8(%ecx),%eax - 1bc6: 8b 44 81 14 mov 0x14(%ecx,%eax,4),%eax - 1bca: 89 45 f0 mov %eax,0xfffffff0(%ebp) + item = *(--bucket->ub_last); + 1bbe: 8b 51 0c mov 0xc(%ecx),%edx + 1bc1: 8d 42 fc lea 0xfffffffc(%edx),%eax + 1bc4: 89 41 0c mov %eax,0xc(%ecx) + 1bc7: 8b 52 fc mov 0xfffffffc(%edx),%edx + 1bca: 89 55 f0 mov %edx,0xfffffff0(%ebp)
here even more refereces to memory in your variant. - bucket->ub_bucket[bucket->ub_cnt++] = item; - 22b9: 0f bf c2 movswl %dx,%eax - 22bc: 8b 4d 0c mov 0xc(%ebp),%ecx - 22bf: 89 4c 83 14 mov %ecx,0x14(%ebx,%eax,4) - 22c3: 8d 42 01 lea 0x1(%edx),%eax - 22c6: 66 89 43 08 mov %ax,0x8(%ebx) + *(bucket->ub_last++) = item; + 22b9: 8b 43 0c mov 0xc(%ebx),%eax + 22bc: 8b 55 0c mov 0xc(%ebp),%edx + 22bf: 89 10 mov %edx,(%eax) + 22c1: 83 43 0c 04 addl $0x4,0xc(%ebx) ----- Original Message ----- From: "Nikos Ntarmos" <[EMAIL PROTECTED]> To: "ant" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, June 30, 2005 7:31 PM Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() > Hi there. > > I wouldn't have gone into this if ant hadn't produced that 10% figure > for the speed improvement with simply reordering of increments and > dereferences (although jhb@ reported the speed-up he noticed was much > less than that). > > I attach* a patch that: (i) incorporates ant's exchange of uc_freebucket > for uc_allocbucket, and (ii) throws away the uma_bucket.ub_cnt counter > of free bucket entries, in favor of a pointer -- uma_bucket.ub_last -- > to the last free bucket entry. If a simple reordering is capable of > producing a 10% improvement, this change should do much better, since it > saves the 'add-' in the 'add-and-dereference' process of using arrays > and counters. The semantics of the pointer closely follow those of the > ub_cnt counter: ub_last - ub_bucket should equal the old value of > ub_cnt. > > I grep'ed through the whole source repository and the uses of > uma_bucket.ub_cnt seem confined within sys/vm/uma_core.c, so this change > must be quite self-contained -- i.e. the change in the fields of > uma_bucket doesn't seem to affect any other part of the system. One > could argue that it may make the code a bit less readable, but it only > affects uma_core.c, so it may be worth the "inconvenience". > > I don't have a FreeBSD box around any more, so I can't test this patch. > Heck, I can't either check it for syntax errors and such, so don't throw > things at me if this doesn't even compile. Can somebody with the time > and resources give it a try? > > \n\n > > * Also online at http://noth.ceid.upatras.gr/Misc/uma_bucket.diff > to avoid being bitten by mailers auto{wrapp,indent}ing the diff > content. > _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"