witness performance improvements

Attilio Rao attilio at freebsd.org
Tue Aug 5 14:52:58 UTC 2008


2008/7/19, Jeff Roberson <jroberson at jroberson.net>:
> Hello,
>
> I have a patch that improves witness performance available at:
>
> http://people.freebsd.org/~jeff/witness.diff
>
> This improvement comes at the cost of some significant space overhead.  It
> changes the witness graph from a linked tree to a matrix based approach.
> Relationships can be quickly resolved with a table lookup.  The table size
> is WITNESS_COUNT^2, or 1MB with the current count of 1024.
>
> This patch also makes struct witness objects persistent even after the last
> lock using this name has been removed.  This is helpful for short lived
> objects which may be created frequently.
>
> To reduce lock contention on SMP witness_checkorder() now runs without the
> w_mtx when there are no lock violations.  I also cache a lock_list_entry in
> each thread as allocating these requires the w_mtx.  The entry is disposed
> of at thread_exit().
>
> There is also a new sysctl that produces dot output which graphs lock order
> relationships with the graphviz program.
>
> Most of this work was done by Ilya Maykov while he was at Isilon systems.
> The locking work and some cleanup/porting/refinement was done by me on
> behalf of Nokia.
>
> The performance improvement can be significant.  It is only on the order of
> 10-20% for buildkernel but on a packet forwarding test at nokia it sped
> things up by 5x putting a witness enabled kernel within about 50% of the
> performance of a kernel without.  I believe buildworld isn't helped as much
> because forking and exiting a lot would then contend on the witness lock.

Hello,
here there is a fixed version of the Jeff's patch:
http://community.gufi.org/~rookie/witness_fast.diff

It fixes some bugs, imports the "comma serparated" approach for
fullgraph and drops the cyclegraph (which can be now evicted by the
fullgraph through handy scripts).
I'd like people test this "final" version before it hits the tree and
give feedbacks.

Thanks,
Attilio

PS: consider this patch not exactly to be set as an example in regard
of "diff reduction against head" :)

-- 
Peace can only be achieved by understanding - A. Einstein


More information about the freebsd-arch mailing list