On Fri, Jul 5, 2019 at 12:10 PM Matthew Wilcox willy@infradead.org wrote:
On Thu, Jul 04, 2019 at 04:27:14PM -0700, Dan Williams wrote:
On Thu, Jul 4, 2019 at 12:14 PM Matthew Wilcox willy@infradead.org wrote:
On Thu, Jul 04, 2019 at 06:54:50PM +0200, Jan Kara wrote:
On Wed 03-07-19 20:27:28, Matthew Wilcox wrote:
So I think we're good for all current users.
Agreed but it is an ugly trap. As I already said, I'd rather pay the unnecessary cost of waiting for pte entry and have an easy to understand interface. If we ever have a real world use case that would care for this optimization, we will need to refactor functions to make this possible and still keep the interfaces sane. For example get_unlocked_entry() could return special "error code" indicating that there's no entry with matching order in xarray but there's a conflict with it. That would be much less error-prone interface.
This is an internal interface. I think it's already a pretty gnarly interface to use by definition -- it's going to sleep and might return almost anything. There's not much scope for returning an error indicator either; value entries occupy half of the range (all odd numbers between 1 and ULONG_MAX inclusive), plus NULL. We could use an internal entry, but I don't think that makes the interface any easier to use than returning a locked entry.
I think this iteration of the patch makes it a little clearer. What do you think?
Not much clearer to me. get_unlocked_entry() is now misnamed and this
misnamed? You'd rather it was called "try_get_unlocked_entry()"?
I was thinking more along the lines of get_unlocked_but_sometimes_locked_entry(), i.e. per Jan's feedback to keep the interface simple.