All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>,
	akpm@linux-foundation.org, penguin-kernel@I-love.SAKURA.ne.jp,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, hpa@zytor.com,
	chris@chris-wilson.co.uk, hch@lst.de, mingo@elte.hu,
	jszhang@marvell.com, joelaf@google.com, joaodias@google.com,
	willy@infradead.org, tglx@linutronix.de, stable@vger.kernel.org
Subject: Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context
Date: Wed, 5 Apr 2017 12:42:25 +0200	[thread overview]
Message-ID: <20170405104224.GH6035@dhcp22.suse.cz> (raw)
In-Reply-To: <d28bc808-0aab-d36a-f401-9925680fd131@virtuozzo.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>,
	akpm@linux-foundation.org, penguin-kernel@I-love.SAKURA.ne.jp,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, hpa@zytor.com,
	chris@chris-wilson.co.uk, hch@lst.de, mingo@elte.hu,
	jszhang@marvell.com, joelaf@google.com, joaodias@google.com,
	willy@infradead.org, tglx@linutronix.de, stable@vger.kernel.org
Subject: Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context
Date: Wed, 5 Apr 2017 12:42:25 +0200	[thread overview]
Message-ID: <20170405104224.GH6035@dhcp22.suse.cz> (raw)
In-Reply-To: <d28bc808-0aab-d36a-f401-9925680fd131@virtuozzo.com>

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-04-05 10:43 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 10:27 [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Andrey Ryabinin
2017-03-30 10:27 ` Andrey Ryabinin
2017-03-30 10:27 ` Andrey Ryabinin
2017-03-30 10:27 ` [PATCH 2/4] x86/ldt: use vfree() instead of vfree_atomic() Andrey Ryabinin
2017-03-30 10:27   ` Andrey Ryabinin
2017-03-31  8:05   ` Thomas Gleixner
2017-03-31  8:05     ` Thomas Gleixner
2017-03-30 10:27 ` [PATCH 3/4] kernel/fork: use vfree() instead of vfree_atomic() to free thread stack Andrey Ryabinin
2017-03-30 10:27   ` Andrey Ryabinin
2017-03-30 10:27 ` [PATCH 4/4] mm/vmalloc: remove vfree_atomic() Andrey Ryabinin
2017-03-30 10:27   ` Andrey Ryabinin
2017-03-30 17:18   ` Matthew Wilcox
2017-03-30 17:18     ` Matthew Wilcox
2017-03-30 15:27     ` Andrey Ryabinin
2017-03-30 15:27       ` Andrey Ryabinin
2017-04-04  9:40   ` Michal Hocko
2017-04-04  9:40     ` Michal Hocko
2017-03-30 12:00 ` [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context Thomas Hellstrom
2017-03-30 12:00   ` Thomas Hellstrom
2017-03-30 12:00   ` Thomas Hellstrom
2017-03-30 14:48   ` Andrey Ryabinin
2017-03-30 14:48     ` Andrey Ryabinin
2017-03-30 14:48     ` Andrey Ryabinin
2017-03-30 15:04     ` Thomas Hellstrom
2017-03-30 15:04       ` Thomas Hellstrom
2017-03-30 15:04       ` Thomas Hellstrom
2017-04-04  9:41     ` Michal Hocko
2017-04-04  9:41       ` Michal Hocko
2017-04-04  9:49       ` Thomas Hellstrom
2017-04-04  9:49         ` Thomas Hellstrom
2017-04-04  9:49         ` Thomas Hellstrom
2017-04-05 10:31       ` Andrey Ryabinin
2017-04-05 10:31         ` Andrey Ryabinin
2017-04-05 10:31         ` Andrey Ryabinin
2017-04-05 10:42         ` Michal Hocko [this message]
2017-04-05 10:42           ` Michal Hocko
2017-04-05 11:42     ` Vlastimil Babka
2017-04-05 11:42       ` Vlastimil Babka
2017-04-05 12:14       ` Michal Hocko
2017-04-05 12:14         ` Michal Hocko
2017-03-30 22:22 ` Andrew Morton
2017-03-30 22:22   ` Andrew Morton
2017-03-30 22:22   ` Andrew Morton
2017-03-31  7:12   ` Joel Fernandes
2017-03-31  7:12     ` Joel Fernandes
2017-03-31  9:26   ` Andrey Ryabinin
2017-03-31  9:26     ` Andrey Ryabinin
2017-03-31  9:26     ` Andrey Ryabinin
2017-04-04  9:36   ` Michal Hocko
2017-04-04  9:36     ` Michal Hocko
2017-04-04  9:38 ` Michal Hocko
2017-04-04  9:38   ` Michal Hocko
2017-04-12 12:49 ` [PATCH v2 0/5] " Andrey Ryabinin
2017-04-12 12:49   ` Andrey Ryabinin
2017-04-12 12:49   ` [PATCH v2 1/5] mm/vmalloc: " Andrey Ryabinin
2017-04-12 12:49     ` Andrey Ryabinin
2017-04-12 12:49     ` Andrey Ryabinin
2017-04-12 12:49   ` [PATCH v2 2/5] x86/ldt: use vfree() instead of vfree_atomic() Andrey Ryabinin
2017-04-12 12:49     ` Andrey Ryabinin
2017-04-12 12:49   ` [PATCH v2 3/5] kernel/fork: use vfree() instead of vfree_atomic() to free thread stack Andrey Ryabinin
2017-04-12 12:49     ` Andrey Ryabinin
2017-04-12 12:49   ` [PATCH v2 4/5] mm/vmalloc: remove vfree_atomic() Andrey Ryabinin
2017-04-12 12:49     ` Andrey Ryabinin
2017-04-12 12:49   ` [PATCH v2 5/5] mm/vmalloc: Don't spawn workers if somebody already purging Andrey Ryabinin
2017-04-12 12:49     ` Andrey Ryabinin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170405104224.GH6035@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=joaodias@google.com \
    --cc=joelaf@google.com \
    --cc=jszhang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thellstrom@vmware.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.