How does [=rcu_dereference_protected(ptr, 1)] differ from simple [=ptr]?

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

 



Hi,

according to the documentation, [rcu_dereference_protected( ptr, condition )] is the "update-side primitive" that reads the ptr, "allowing the code to verify that the required locks really are held".

Given that, I expect that literal `1' as `condition' would imply just "reading the ptr".

Indeed, the macro expansion of

    = rcu_dereference_protected( ptr, 1 )

is roughly equals to just

    = ({ (typeof(*ptr) *)ptr; })

i.e. simple

    = ptr

that agrees with my expectation. So, coding [rcu_dereference_protected( ..., 1 )] looks like a waste of key presses.

However, expression [rcu_dereference_protected( ..., 1 )] routinely appears in the kernel sources, many times.

Why? Did I miss something?

Regards, Konstantin.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux