]> git.proxmox.com Git - mirror_spl-debian.git/commit
Optimize lowest outstanding taskqid calculation in taskq_lowest_id()
authorBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 4 Jan 2010 23:52:26 +0000 (15:52 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 4 Jan 2010 23:52:26 +0000 (15:52 -0800)
commit82387586af283ac5fa6cde5d316f7ed4c587efec
tree56623ed873e7dace5b0eb979c3847b26bec3fc7d
parentef1c7a069131512458be75aae1e4857fcd8f133b
Optimize lowest outstanding taskqid calculation in taskq_lowest_id()

In the initial version of taskq_lowest_id() the entire pending and
work list was locked under the tq->tq_lock to determine the lowest
outstanding taskqid.  At the time this done because I was rushed
and wanted to make sure it was right... fast was secondary.  Well now
fast is important too so I carefully thought through the pending
and work list management and convinced myself it is safe and correct
to simply check the first entry.  I added a large comment to the source
to explain this.  But basically as long as we are careful to ensure the
pending and work list stay sorted this is safe and fast.

The motivation for this chance was that I was observing as much as
10% of the total CPU time go to waiting on the tq->tq_lock when the
pending list was long.  This resolves that problems and frees up
that CPU time for something useful.
module/spl/spl-taskq.c