* Peter Zijlstra (peterz@infradead.org) wrote:Actually, we could probably do the following, which also adds an extra coherency check about non-NULL pointer assumptions : #ifdef CONFIG_RCU_DEBUG /* this would be new */ #define DEBUG_RCU_BUG_ON(x) BUG_ON(x) #else #define DEBUG_RCU_BUG_ON(x) #endif #define rcu_dereference(p) ({ \ typeof(p) _________p1 = ACCESS_ONCE(p); \ if (p != NULL) \ smp_read_barrier_depends(); \ (_________p1); \ }) #define rcu_dereference_non_null(p) ({ \ typeof(p) _________p1 = ACCESS_ONCE(p); \ DEBUG_RCU_BUG_ON(p == NULL); \ smp_read_barrier_depends(); \ (_________p1); \ }) The use-case where rcu_dereference() would be used is when it is followed by a null pointer check (grepping through the sources shows me this is a very very common case). In rare cases, it is assumed that the pointer is never NULL and it is used just after the rcu_dereference. It those cases, the extra test could be saved on alpha by using rcu_dereference_non_null(p), which would check the the pointer is indeed never NULL under some debug kernel configuration. Does it make sense ? Mathieu -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 --
| david | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| David Miller | Re: [RFC/PATCH] Documentation of kernel messages |
| Tony Lindgren | [PATCH 48/90] ARM: OMAP: I2C-1 init fix for 2430 |
git: | |
| Josip Rodin | bnx2_poll panicking kernel |
| Gerrit Renker | [PATCH 03/37] dccp: List management for new feature negotiation |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
