Re: staging: r8188eu: how to handle nested mutex under spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

On 4/4/22 19:59, David Laight wrote:
From: Pavel Skripkin
Sent: 04 April 2022 17:39

Hi David,

On 4/4/22 11:50, David Laight wrote:
>>
>> > 		while (pwrpriv->bInSuspend &&
>>
>> I've looked into what gcc11 produced from this function and looks like
>> my compiler is smart enough to not cache that value, but I am afraid not
>> all compilers are that smart.
>
> The compiler can't cache the value because of the function call.
>

Hm, I am a newbie in compilers, so can you, please, explain (or give a
link to any resource where I can read about it) how function call here
prevent caching.

IIUC compiler generates code that works well in scope of single-threaded
application, so why can't compiler cache that value instead of accessing
memory on each iteration... Isn't register access a way faster than even
cache hit?

Because calls to external functions are allowed to change
any data via 'other' references.
For instance the structure pointer the function has could
also be in global data somewhere.


Make sense, thank you for explanation!




With regards,
Pavel Skripkin

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux