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