On Mon, Dec 23, 2024 at 10:09:35AM -0300, Diego Nieto Cid wrote: > > > > No, this would lock/unlock the map twice. Rather see if you can do the > > check after the map is already locked, perhaps right before "See > > whether we can avoid creating a new entry ...". > > > > At that point vm_map_find_entry_anywhere or vm_map_lookup_entry have already > been > called. I'm not sure if it is ok to check the limit after the map entry is > allocated. :/ > Well, I've read it again, and it seems neither of those functions allocate memory (nor entries) and just find an existing entry for a given address (or map in the case of vm_map_find_entry_anywhere).
So I believe it's possible to relocate the check to avoid locking twice.