Re: [PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-19 Thread Al Viro
On Thu, Apr 18, 2019 at 03:24:31PM -0700, Andrew Morton wrote: > On Thu, 18 Apr 2019 04:18:34 -0700 Matthew Wilcox wrote: > > > On Wed, Apr 17, 2019 at 02:58:27PM -0700, Andrew Morton wrote: > > > On Wed, 17 Apr 2019 12:40:01 -0700 Roman Gushchin > > > wrote: > > > > +static struct vm_struct

Re: [PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-18 Thread Eric Dumazet
On 04/18/2019 03:24 PM, Andrew Morton wrote: > afaict, vfree() will only do a mutex_trylock() in > try_purge_vmap_area_lazy(). So does vfree actually sleep in any > situation? Whether or not local interrupts are enabled? We would be in a big trouble if vfree() could potentially sleep...

Re: [PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-18 Thread Andrew Morton
On Thu, 18 Apr 2019 04:18:34 -0700 Matthew Wilcox wrote: > On Wed, Apr 17, 2019 at 02:58:27PM -0700, Andrew Morton wrote: > > On Wed, 17 Apr 2019 12:40:01 -0700 Roman Gushchin wrote: > > > +static struct vm_struct *__remove_vm_area(struct vmap_area *va) > > > +{ > > > + struct vm_struct *vm =

Re: [PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-18 Thread Matthew Wilcox
On Wed, Apr 17, 2019 at 02:58:27PM -0700, Andrew Morton wrote: > On Wed, 17 Apr 2019 12:40:01 -0700 Roman Gushchin wrote: > > +static struct vm_struct *__remove_vm_area(struct vmap_area *va) > > +{ > > + struct vm_struct *vm = va->vm; > > + > > + might_sleep(); > > Where might

Re: [PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-17 Thread Roman Gushchin
On Wed, Apr 17, 2019 at 02:58:27PM -0700, Andrew Morton wrote: > On Wed, 17 Apr 2019 12:40:01 -0700 Roman Gushchin wrote: > > > __vunmap() calls find_vm_area() twice without an obvious reason: > > first directly to get the area pointer, second indirectly by calling > > remove_vm_area(), which is

Re: [PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-17 Thread Andrew Morton
On Wed, 17 Apr 2019 12:40:01 -0700 Roman Gushchin wrote: > __vunmap() calls find_vm_area() twice without an obvious reason: > first directly to get the area pointer, second indirectly by calling > remove_vm_area(), which is again searching for the area. > > To remove this redundancy, let's

[PATCH v4 1/2] mm: refactor __vunmap() to avoid duplicated call to find_vm_area()

2019-04-17 Thread Roman Gushchin
__vunmap() calls find_vm_area() twice without an obvious reason: first directly to get the area pointer, second indirectly by calling remove_vm_area(), which is again searching for the area. To remove this redundancy, let's split remove_vm_area() into __remove_vm_area(struct vmap_area *), which