linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] module: avoid userspace pressure on unwanted allocations
@ 2023-03-29  5:31 Luis Chamberlain
  2023-03-29  5:31 ` [PATCH 1/7] module: move finished_loading() Luis Chamberlain
                   ` (6 more replies)
  0 siblings, 7 replies; 26+ messages in thread
From: Luis Chamberlain @ 2023-03-29  5:31 UTC (permalink / raw)
  To: david, patches, linux-modules, linux-mm, linux-kernel, pmladek,
	petr.pavlu, prarit, torvalds, gregkh, rafael
  Cc: christophe.leroy, tglx, peterz, song, rppt, willy, vbabka, mhocko,
	dave.hansen, mcgrof

This patch set addresses a fix to the vmap allocation presure issues which
David Hildenbrand had reported last year in October. While at it,
I've simplified the kmod concurrency delimiter using Linus' suggestion,
and added debugfs stats to help us keep sane in doing analysis for memory
pressure issues on the finit_module() side of things. That should *also*
help do an empirical evaluation of module .text sizes *actually* present
on systems, given userspace makes it a bit tricky to get that right.

All this would not have been possible without stress-ng and Colin Ian King's
help to getting a modules ops in shape so to reproduce a situation only
reported so far on a system with over 400 CPUs.

I *think* the degugfs stats *should* probably be used to help identify
areas where we perhaps need *more work* to try to mitigate vmalloc()
space, as in the worst case we can end up using vmap space 3 times for
a single module, two just as big as the module, and if you are enabling
compression one with the compressed module size. That's significant memory
pressure on vmalloc() / vmap() space.

If you'd like to give this a spin this is available on my branch based on
modules-next 20230328-module-alloc-opts [2].

[0] https://lkml.kernel.org/r/20221013180518.217405-1-david@redhat.com
[1] https://github.com/ColinIanKing/stress-ng
[2] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=20230328-module-alloc-opts

Luis Chamberlain (7):
  module: move finished_loading()
  module: extract patient module check into helper
  module: avoid allocation if module is already present and ready
  sempahore: add a helper for a concurrency limiter
  modules/kmod: replace implementation with a sempahore
  debugfs: add debugfs_create_atomic64_t for atomic64_t
  module: add debug stats to help identify memory pressure

 fs/debugfs/file.c         |  36 +++++++
 include/linux/debugfs.h   |   2 +
 include/linux/semaphore.h |   3 +
 kernel/module/Kconfig     |  32 ++++++
 kernel/module/Makefile    |   4 +
 kernel/module/debug.c     |  16 +++
 kernel/module/internal.h  |  35 +++++++
 kernel/module/kmod.c      |  26 ++---
 kernel/module/main.c      | 164 ++++++++++++++++++++-----------
 kernel/module/stats.c     | 200 ++++++++++++++++++++++++++++++++++++++
 kernel/module/tracking.c  |   7 +-
 11 files changed, 445 insertions(+), 80 deletions(-)
 create mode 100644 kernel/module/debug.c
 create mode 100644 kernel/module/stats.c

-- 
2.39.2



^ permalink raw reply	[flat|nested] 26+ messages in thread
* [PATCH 0/7] module: avoid userspace pressure on unwanted allocations
@ 2023-03-29  5:29 Luis Chamberlain
  0 siblings, 0 replies; 26+ messages in thread
From: Luis Chamberlain @ 2023-03-29  5:29 UTC (permalink / raw)
  To: david, patches, linux-modules, linux-mm, linux-kernel, pmladek,
	petr.pavlu, prarit, torvalds, gregkh, rafael
  Cc: christophe.leroy, tglx, peterz, song, rppt, willy, vbabka, mhocko,
	dave.hansen, mcgrof

This patch set addresses a fix to the vmap allocation presure issues which
David Hildenbrand had reported last year in October. While at it,
I've simplified the kmod concurrency delimiter using Linus' suggestion,
and added debugfs stats to help us keep sane in doing analysis for memory
pressure issues on the finit_module() side of things. That should *also*
help do an empirical evaluation of module .text sizes *actually* present
on systems, given userspace makes it a bit tricky to get that right.

All this would not have been possible without stress-ng and Colin Ian King's
help to getting a modules ops in shape so to reproduce a situation only
reported so far on a system with over 400 CPUs.

I *think* the degugfs stats *should* probably be used to help identify
areas where we perhaps need *more work* to try to mitigate vmalloc()
space, as in the worst case we can end up using vmap space 3 times for
a single module, two just as big as the module, and if you are enabling
compression one with the compressed module size. That's significant memory
pressure on vmalloc() / vmap() space.

If you'd like to give this a spin this is available on my branch based on
modules-next 20230328-module-alloc-opts [2].

[0] https://lkml.kernel.org/r/20221013180518.217405-1-david@redhat.com
[1] https://github.com/ColinIanKing/stress-ng
[2] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=20230328-module-alloc-opts

Luis Chamberlain (7):
  module: move finished_loading()
  module: extract patient module check into helper
  module: avoid allocation if module is already present and ready
  sempahore: add a helper for a concurrency limiter
  modules/kmod: replace implementation with a sempahore
  debugfs: add debugfs_create_atomic64_t for atomic64_t
  module: add debug stats to help identify memory pressure

 fs/debugfs/file.c         |  36 +++++++
 include/linux/debugfs.h   |   2 +
 include/linux/semaphore.h |   3 +
 kernel/module/Kconfig     |  32 ++++++
 kernel/module/Makefile    |   4 +
 kernel/module/debug.c     |  16 +++
 kernel/module/internal.h  |  35 +++++++
 kernel/module/kmod.c      |  26 ++---
 kernel/module/main.c      | 164 ++++++++++++++++++++-----------
 kernel/module/stats.c     | 200 ++++++++++++++++++++++++++++++++++++++
 kernel/module/tracking.c  |   7 +-
 11 files changed, 445 insertions(+), 80 deletions(-)
 create mode 100644 kernel/module/debug.c
 create mode 100644 kernel/module/stats.c

-- 
2.39.2



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-03-31  8:05 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-29  5:31 [PATCH 0/7] module: avoid userspace pressure on unwanted allocations Luis Chamberlain
2023-03-29  5:31 ` [PATCH 1/7] module: move finished_loading() Luis Chamberlain
2023-03-29  5:31 ` [PATCH 2/7] module: extract patient module check into helper Luis Chamberlain
2023-03-29  5:31 ` [PATCH 3/7] module: avoid allocation if module is already present and ready Luis Chamberlain
2023-03-29  5:31 ` [PATCH 4/7] sempahore: add a helper for a concurrency limiter Luis Chamberlain
2023-03-29  7:21   ` Peter Zijlstra
2023-03-29  7:51     ` Luis Chamberlain
2023-03-29  9:19       ` Peter Zijlstra
2023-03-29  9:49         ` Luis Chamberlain
2023-03-29 10:14           ` Peter Zijlstra
2023-03-29 16:50         ` Linus Torvalds
2023-03-30 11:56           ` Peter Zijlstra
2023-03-30 16:23             ` Linus Torvalds
2023-03-31  3:42               ` Sergey Senozhatsky
2023-03-31  8:05                 ` Petr Mladek
2023-03-31  3:45               ` Luis Chamberlain
2023-03-31  4:06                 ` Matthew Wilcox
2023-03-31  4:13                   ` Luis Chamberlain
2023-03-31  4:11                 ` Sergey Senozhatsky
2023-03-29  5:31 ` [PATCH 5/7] modules/kmod: replace implementation with a sempahore Luis Chamberlain
2023-03-29  5:31 ` [PATCH 6/7] debugfs: add debugfs_create_atomic64_t for atomic64_t Luis Chamberlain
2023-03-29  5:46   ` Greg KH
2023-03-29  5:31 ` [PATCH 7/7] module: add debug stats to help identify memory pressure Luis Chamberlain
2023-03-29  5:46   ` Greg KH
2023-03-29  6:04     ` Luis Chamberlain
  -- strict thread matches above, loose matches on Subject: below --
2023-03-29  5:29 [PATCH 0/7] module: avoid userspace pressure on unwanted allocations Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).