Re: Question: Why the definition of ULONG_CMP_LE is different with time_before?

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

 



Hi Alan,

The reason for a different implementation looks to be due to the fact that the C standard does not specify the result of an operation that overflows a signed integer. This is described in lwn article: https://lwn.net/Articles/511259/ . On 32-bit systems, overflow would be common for counters used by RCU. So, RCU subsystem uses unsigned integers checks - ULONG_CMP_GE , ULONG_CMP_LT , to avoid any compiler optimization, which would cause results of these checks to have a different result, in the event of counter overflows.


Thanks
Neeraj


On 4/16/2023 2:19 PM, Alan Huang wrote:
Hi,

I noticed that the definition of ULONG_CMP_LE in rcupdate.h is different with time_before.

I can’t figure it out that why their definition is different. Does the two definition are the same thing?

Thanks,
Alan






[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux