rcu: fix possible bug in include/linux/pagemap.h
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Paul E. McKenney
Quoted 15 lines · Lai Jiangshan
I read the code and comments written by Nick Piggin(mainly from
e286781d),page_cache_get_speculative()is protected byrcu_read_lock(),
it may be preempted when preemptible RCU, so we must useget_page_unless_zero()in this situation.In the days of
e286781d, we only haveCLASSIC_RCUand (old)PREEMPT_RCU, so "defined(CONFIG_CLASSIC_RCU)" means non-preemptible RCU and the code is correct.In the days of
b560d8ad, we only haveTREE_RCUandTREE_PREEMPT_RCU, so "defined(CONFIG_TREE_RCU)" means non-preemptible RCU and the code is correct.But in nowadays, we have
TREE_RCU,TREE_PREEMPT_RCU,TINY_RCUandTINY_PREEMPT_RCU, so the "defined(CONFIG_TREE_RCU)" for non-preemptible RCU is incorrect, and it may causes bugs. we should use "!defined(CONFIG_PREEMPT_RCU)" for non-preemptible RCU code block.
Quoted 9 lines
Quoted 4 lines
CC Nick Piggin <[email protected]>Cc Paul E. McKenney <[email protected]>Reported-by WANG Cong <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>Good catch!!!
Acked-by Paul E. McKenney <[email protected]>
Sorry, I forgot to CC it to LKML. Added it.
Hi, Nick Piggin,
Could you review it?
Thanks,
Lai
Américo Wang
Reviewed-byQuoted 22 lines · Lai Jiangshan
Quoted 21 lines · Paul E. McKenney
Quoted 19 lines · Lai Jiangshan
I read the code and comments written by Nick Piggin(mainly from
e286781d),page_cache_get_speculative()is protected byrcu_read_lock(),
it may be preempted when preemptible RCU, so we must useget_page_unless_zero()in this situation.In the days of
e286781d, we only haveCLASSIC_RCUand (old)PREEMPT_RCU, so "defined(CONFIG_CLASSIC_RCU)" means non-preemptible RCU and the code is correct.In the days of
b560d8ad, we only haveTREE_RCUandTREE_PREEMPT_RCU, so "defined(CONFIG_TREE_RCU)" means non-preemptible RCU and the code is correct.But in nowadays, we have
TREE_RCU,TREE_PREEMPT_RCU,TINY_RCUandTINY_PREEMPT_RCU, so the "defined(CONFIG_TREE_RCU)" for non-preemptible RCU is incorrect, and it may causes bugs. we should use "!defined(CONFIG_PREEMPT_RCU)" for non-preemptible RCU code block.CC Nick Piggin <[email protected]>Cc Paul E. McKenney <[email protected]>Reported-by WANG Cong <[email protected]>Signed-off-by Lai Jiangshan <[email protected]>
Quoted 8 lines
Quoted 4 lines
Good catch!!!
Acked-by Paul E. McKenney <[email protected]>Sorry, I forgot to CC it to LKML. Added it.
Thanks for fixing this!
The description explains quite well, so I am okay with this patch,
BTW, you added my company email in Reported-by, but Cc'ed my gmail. ;-)