Re: [PATCH] list: Expand list_first_entry_or_null()

2016-07-24 Thread Paul E. McKenney
On Sat, Jul 23, 2016 at 07:27:50PM +0100, Chris Wilson wrote: > Due to the use of READ_ONCE() in list_empty() the compiler cannot > optimise !list_empty() ? list_first_entry() : NULL very well. By > manually expanding list_first_entry_or_null() we can take advantage of > the READ_ONCE() to avoid th

[PATCH] list: Expand list_first_entry_or_null()

2016-07-23 Thread Chris Wilson
Due to the use of READ_ONCE() in list_empty() the compiler cannot optimise !list_empty() ? list_first_entry() : NULL very well. By manually expanding list_first_entry_or_null() we can take advantage of the READ_ONCE() to avoid the list element changing under the test while the compiler can generate