Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1615832 > unrolled thread

Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context

Started byMichal Hocko <mhocko@kernel.org>
First post2017-04-04 11:50 +0200
Last post2017-04-05 12:50 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Michal Hocko <mhocko@kernel.org> - 2017-04-04 11:50 +0200
    Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Michal Hocko <mhocko@kernel.org> - 2017-04-05 12:50 +0200

#1615832 — Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context

FromMichal Hocko <mhocko@kernel.org>
Date2017-04-04 11:50 +0200
SubjectRe: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context
Message-ID<tstg5-33o-1@gated-at.bofh.it>
On Thu 30-03-17 17:48:39, Andrey Ryabinin wrote:
> From: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Subject: mm/vmalloc: allow to call vfree() in atomic context fix
> 
> Don't spawn worker if we already purging.
> 
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

I would rather put this into a separate patch. Ideally with some numners
as this is an optimization...

> ---
>  mm/vmalloc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index ea1b4ab..88168b8 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -737,7 +737,8 @@ static void free_vmap_area_noflush(struct vmap_area *va)
>  	/* After this point, we may free va at any time */
>  	llist_add(&va->purge_list, &vmap_purge_list);
>  
> -	if (unlikely(nr_lazy > lazy_max_pages()))
> +	if (unlikely(nr_lazy > lazy_max_pages()) &&
> +	    !mutex_is_locked(&vmap_purge_lock))
>  		schedule_work(&purge_vmap_work);
>  }
>  
> -- 
> 2.10.2
> 

-- 
Michal Hocko
SUSE Labs

[toc] | [next] | [standalone]


#1616829

FromMichal Hocko <mhocko@kernel.org>
Date2017-04-05 12:50 +0200
Message-ID<tsQFI-1vp-25@gated-at.bofh.it>
In reply to#1615832
On Wed 05-04-17 13:31:23, Andrey Ryabinin wrote:
> On 04/04/2017 12:41 PM, Michal Hocko wrote:
> > On Thu 30-03-17 17:48:39, Andrey Ryabinin wrote:
> >> From: Andrey Ryabinin <aryabinin@virtuozzo.com>
> >> Subject: mm/vmalloc: allow to call vfree() in atomic context fix
> >>
> >> Don't spawn worker if we already purging.
> >>
> >> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> > 
> > I would rather put this into a separate patch. Ideally with some numners
> > as this is an optimization...
> > 
> 
> It's quite simple optimization and don't think that this deserves to
> be a separate patch.

I disagree. I am pretty sure nobody will remember after few years. I
do not want to push too hard on this but I can tell you from my own
experience that we used to do way too many optimizations like that in
the past and they tend to be real head scratchers these days. Moreover
people just tend to build on top of them without understadning and then
chances are quite high that they are no longer relevant anymore.

> But I did some measurements though. With enabled VMAP_STACK=y and
> NR_CACHED_STACK changed to 0 running fork() 100000 times gives this:
> 
> With optimization:
> 
> ~ # grep try_purge /proc/kallsyms 
> ffffffff811d0dd0 t try_purge_vmap_area_lazy
> ~ # perf stat --repeat 10 -ae workqueue:workqueue_queue_work --filter 'function == 0xffffffff811d0dd0' ./fork
> 
>  Performance counter stats for 'system wide' (10 runs):
> 
>                 15      workqueue:workqueue_queue_work                                     ( +-  0.88% )
> 
>        1.615368474 seconds time elapsed                                          ( +-  0.41% )
> 
> 
> Without optimization:
> ~ # grep try_purge /proc/kallsyms 
> ffffffff811d0dd0 t try_purge_vmap_area_lazy
> ~ # perf stat --repeat 10 -ae workqueue:workqueue_queue_work --filter 'function == 0xffffffff811d0dd0' ./fork
> 
>  Performance counter stats for 'system wide' (10 runs):
> 
>                 30      workqueue:workqueue_queue_work                                     ( +-  1.31% )
> 
>        1.613231060 seconds time elapsed                                          ( +-  0.38% )
> 
> 
> So there is no measurable difference on the test itself, but we queue
> twice more jobs without this optimization.  It should decrease load of
> kworkers.

And this is really valueable for the changelog!

Thanks!
-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web