linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: david@redhat.com, patches@lists.linux.dev,
	linux-modules@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, pmladek@suse.com,
	petr.pavlu@suse.com, prarit@redhat.com,
	torvalds@linux-foundation.org, gregkh@linuxfoundation.org,
	rafael@kernel.org
Cc: christophe.leroy@csgroup.eu, tglx@linutronix.de,
	peterz@infradead.org, song@kernel.org, rppt@kernel.org,
	willy@infradead.org, vbabka@suse.cz, mhocko@suse.com,
	dave.hansen@linux.intel.com, mcgrof@kernel.org
Subject: [PATCH 0/7] module: avoid userspace pressure on unwanted allocations
Date: Tue, 28 Mar 2023 22:29:54 -0700	[thread overview]
Message-ID: <20230329052954.3974542-1-mcgrof@kernel.org> (raw)

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



             reply	other threads:[~2023-03-29  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  5:29 Luis Chamberlain [this message]
2023-03-29  5:31 Luis Chamberlain

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=20230329052954.3974542-1-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=patches@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=petr.pavlu@suse.com \
    --cc=pmladek@suse.com \
    --cc=prarit@redhat.com \
    --cc=rafael@kernel.org \
    --cc=rppt@kernel.org \
    --cc=song@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox