On Thu, Jul 4, 2019 at 12:14 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> 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 arrangement allows for mismatches of @order argument vs @xas configuration. Can you describe, or even better demonstrate with numbers, why it's better to carry this complication than just converging the waitqueues between the types?