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


Groups > linux.kernel > #1427260

Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core)

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core)
Date 2016-06-21 06:10 +0200
Message-ID <rMlaF-Mm-5@gated-at.bofh.it> (permalink)
References <rMh73-6ol-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jun 20, 2016 at 4:43 PM, Andy Lutomirski <luto@kernel.org> wrote:
>
> On my laptop, this adds about 1.5µs of overhead to task creation,
> which seems to be mainly caused by vmalloc inefficiently allocating
> individual pages even when a higher-order page is available on the
> freelist.

I really think that problem needs to be fixed before this should be merged.

The easy fix may be to just have a very limited re-use of these stacks
in generic code, rather than try to do anything fancy with multi-page
allocations. Just a few of these allocations held in reserve (perhaps
make the allocations percpu to avoid new locks).

It won't help for a thundering herd problem where you start tons of
new threads, but those don't tend to be short-lived ones anyway. In
contrast, I think one common case is the "run shell scripts" that runs
tons and tons of short-lived processes, and having a small "stack of
stacks" would probably catch that case very nicely. Even a
single-entry cache might be ok, but I see no reason to not make it be
perhaps three or four stacks per CPU.

Make the "thread create/exit" sequence go really fast by avoiding the
allocation/deallocation, and hopefully catching a hot cache and TLB
line too.

Performance is not something that we add later. If the first version
of the patch series doesn't perform well, it should not be considered
ready.

            Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 02/13] x86/cpa: In populate_pgd, don't set the pgd entry until it's populated Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 03/13] x86/mm: Remove kernel_unmap_pages_in_pgd() and efi_cleanup_page_tables() Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
    Re: [PATCH v3 03/13] x86/mm: Remove kernel_unmap_pages_in_pgd() and  efi_cleanup_page_tables() Matt Fleming <matt@codeblueprint.co.uk> - 2016-06-21 12:20 +0200
  [PATCH v3 11/13] x86/dumpstack/64: Handle faults when printing the "Stack:" part of an OOPS Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 06/13] fork: Add generic vmalloced stack support Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
    Re: [PATCH v3 06/13] fork: Add generic vmalloced stack support Jann Horn <jannh@google.com> - 2016-06-21 12:10 +0200
      Re: [PATCH v3 06/13] fork: Add generic vmalloced stack support Andy Lutomirski <luto@amacapital.net> - 2016-06-21 19:10 +0200
        Re: [PATCH v3 06/13] fork: Add generic vmalloced stack support Kees Cook <keescook@chromium.org> - 2016-06-21 19:20 +0200
          Re: [PATCH v3 06/13] fork: Add generic vmalloced stack support Andy Lutomirski <luto@amacapital.net> - 2016-06-21 19:40 +0200
          Re: [kernel-hardening] Re: [PATCH v3 06/13] fork: Add generic  vmalloced stack support Rik van Riel <riel@redhat.com> - 2016-06-21 20:50 +0200
            Re: [kernel-hardening] Re: [PATCH v3 06/13] fork: Add generic  vmalloced stack support Andy Lutomirski <luto@amacapital.net> - 2016-06-21 21:50 +0200
            Re: [kernel-hardening] Re: [PATCH v3 06/13] fork: Add generic vmalloced stack support Arnd Bergmann <arnd@arndb.de> - 2016-06-21 22:00 +0200
  [PATCH v3 04/13] mm: Track NR_KERNEL_STACK in KiB instead of number of stacks Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
    Re: [PATCH v3 04/13] mm: Track NR_KERNEL_STACK in KiB instead of  number of stacks Michal Hocko <mhocko@kernel.org> - 2016-06-22 10:50 +0200
  [PATCH v3 07/13] x86/die: Don't try to recover from an OOPS on a non-default stack Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 08/13] x86/dumpstack: When OOPSing, rewind the stack before do_exit Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 01/13] x86/mm/hotplug: Don't remove PGD entries in remove_pagetable() Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 10/13] x86/dumpstack: Try harder to get a call trace on stack overflow Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  [PATCH v3 09/13] x86/dumpstack: When dumping stack bytes due to OOPS, start with regs->sp Andy Lutomirski <luto@kernel.org> - 2016-06-21 01:50 +0200
  Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Linus Torvalds <torvalds@linux-foundation.org> - 2016-06-21 06:10 +0200
    Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-21 18:50 +0200
      Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Linus Torvalds <torvalds@linux-foundation.org> - 2016-06-21 19:20 +0200
        Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-21 19:40 +0200
          Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Kees Cook <keescook@chromium.org> - 2016-06-21 20:20 +0200
            Re: [kernel-hardening] Re: [PATCH v3 00/13] Virtually mapped stacks  with guard pages (x86, core) Rik van Riel <riel@redhat.com> - 2016-06-21 20:30 +0200
    Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-23 03:30 +0200
      Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Linus Torvalds <torvalds@linux-foundation.org> - 2016-06-23 08:10 +0200
        Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86,  core) Oleg Nesterov <oleg@redhat.com> - 2016-06-23 16:40 +0200
          Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Linus Torvalds <torvalds@linux-foundation.org> - 2016-06-23 18:40 +0200
            Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-23 18:50 +0200
              Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86,  core) Oleg Nesterov <oleg@redhat.com> - 2016-06-23 19:20 +0200
            Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86,  core) Oleg Nesterov <oleg@redhat.com> - 2016-06-23 19:10 +0200
  Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Arnd Bergmann <arnd@arndb.de> - 2016-06-21 11:40 +0200
    Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Kees Cook <keescook@chromium.org> - 2016-06-21 19:30 +0200
      Re: [kernel-hardening] Re: [PATCH v3 00/13] Virtually mapped stacks  with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-21 20:10 +0200
      Re: [kernel-hardening] Re: [PATCH v3 00/13] Virtually mapped stacks  with guard pages (x86, core) Rik van Riel <riel@redhat.com> - 2016-06-21 20:10 +0200
      Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-21 21:50 +0200
        Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Kees Cook <keescook@chromium.org> - 2016-06-21 22:20 +0200
      Re: [PATCH v3 00/13] Virtually mapped stacks with guard pages (x86, core) Arnd Bergmann <arnd@arndb.de> - 2016-06-21 21:50 +0200

csiph-web