Don
Thu Mar 27 10:13:20 CDT 2008
Actually, IIRC KeGetCurrentIrql() is expensive enough that it will probably
decrease performance.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website:
http://www.windrvr.com
Blog:
http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"Uv" <yuvraaj@gmail.com> wrote in message
news:70050799-892a-4bfd-bb6d-466b21945007@h11g2000prf.googlegroups.com...
> On Mar 26, 5:11 pm, Raj <R...@discussions.microsoft.com> wrote:
>> I have a function that uses KeAcquireSpinLock(). This function will be
>> called
>> for each packet in a data stream at DISPATCH_LEVEL and I was interested
>> to
>> tune the performance. Then I read documentation that
>> KeAcquireSpinLockAtDpc()
>> will improve performance. I also want to use this function in few places
>> where it rarely be called at " less than DISPATCH Irql".
>>
>> I am thinking of using KeGetCurrentIrql() to decide whether I use
>> KeAcquireSpinLock() or KeAcquireSpinLockAtDpc(). I am not sure if I
>> should
>> bother to do this or simply always use KeAcquireSpinLock(). Is the
>> performance be considerable to use conditional KeAcquireSpinLockAtDpc() ?
>>
>> Thanks,
>> Raj
>
> Optimizations such as the one you are proposing will affect the total
> throughput only if the code path is under high contention.
> Otherwise, the general rule is to improve the design to get better
> performance and not depend on micro-optimizations.
>
> Regards,
> UV