list: Expand list_first_entry_or_null()
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 23 Jul 2016 18:27:50 +0000 (19:27 +0100)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 22 Aug 2016 14:54:17 +0000 (07:54 -0700)
commit8be561c02567e1f84d3de2b753ff312bb438b02b
tree594e358880d3ca56a87d91fcf095afd0b71f3128
parent29b4817d4018df78086157ea3a55c1d9424a7cfc
list: Expand list_first_entry_or_null()

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 smaller code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Josef Bacik <jbacik@fb.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/list.h
This page took 0.024933 seconds and 5 git commands to generate.