linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: akpm@linux-foundation.org
Cc: kent.overstreet@linux.dev, corbet@lwn.net, arnd@arndb.de,
	 mcgrof@kernel.org, rppt@kernel.org, paulmck@kernel.org,
	thuth@redhat.com,  tglx@linutronix.de, bp@alien8.de,
	xiongwei.song@windriver.com,  ardb@kernel.org, david@redhat.com,
	vbabka@suse.cz, mhocko@suse.com,  hannes@cmpxchg.org,
	roman.gushchin@linux.dev, dave@stgolabs.net,
	 willy@infradead.org, liam.howlett@oracle.com,
	pasha.tatashin@soleen.com,  souravpanda@google.com,
	keescook@chromium.org, dennis@kernel.org,  jhubbard@nvidia.com,
	yuzhao@google.com, vvvvvv@google.com,  rostedt@goodmis.org,
	iamjoonsoo.kim@lge.com, rientjes@google.com,  minchan@google.com,
	kaleshsingh@google.com, linux-doc@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	linux-mm@kvack.org,  linux-modules@vger.kernel.org,
	kernel-team@android.com, surenb@google.com
Subject: [PATCH 0/5] page allocation tag compression
Date: Mon, 19 Aug 2024 08:15:06 -0700	[thread overview]
Message-ID: <20240819151512.2363698-1-surenb@google.com> (raw)

This patchset implements several improvements:
1. Gracefully handles module unloading while there are used allocations
allocated from that module;
2. Provides an option to reduce memory overhead from storing page
allocation references by indexing allocation tags;
3. Provides an option to store page allocation tag references in the
page flags, removing dependency on page extensions and eliminating the
memory overhead from storing page allocation references (~0.2% of total
system memory).
4. Improves page allocation performance when CONFIG_MEM_ALLOC_PROFILING
is enabled by eliminating page extension lookup. Page allocation
performance overhead is reduced from 14% to 5.5%.

Patch #1 copies module tags into virtually contiguous memory which
serves two purposes:
- Lets us deal with the situation when module is unloaded while there
are still live allocations from that module. Since we are using a copy
version of the tags we can safely unload the module. Space and gaps in
this contiguous memory are managed using a maple tree.
- Enables simple indexing of the tags in the later patches.

Preallocated virtually contiguous memory size can be configured using
max_module_alloc_tags kernel parameter.

Patch #2 is a code cleanup to simplify later changes.

Patch #3 abstracts page allocation tag reference to simplify later
changes.

Patch #4 lets us control page allocation tag reference sizes and
introduces tag indexing.

Patch #5 adds a config to store page allocation tag references inside
page flags if they fit.

Patchset applies to mm-unstable.

Suren Baghdasaryan (5):
  alloc_tag: load module tags into separate continuous memory
  alloc_tag: eliminate alloc_tag_ref_set
  alloc_tag: introduce pgalloc_tag_ref to abstract page tag references
  alloc_tag: make page allocation tag reference size configurable
  alloc_tag: config to store page allocation tag refs in page flags

 .../admin-guide/kernel-parameters.txt         |   4 +
 include/asm-generic/codetag.lds.h             |  19 ++
 include/linux/alloc_tag.h                     |  46 ++-
 include/linux/codetag.h                       |  38 ++-
 include/linux/mmzone.h                        |   3 +
 include/linux/page-flags-layout.h             |  10 +-
 include/linux/pgalloc_tag.h                   | 257 ++++++++++++---
 kernel/module/main.c                          |  67 ++--
 lib/Kconfig.debug                             |  36 ++-
 lib/alloc_tag.c                               | 300 ++++++++++++++++--
 lib/codetag.c                                 | 105 +++++-
 mm/mm_init.c                                  |   1 +
 mm/page_ext.c                                 |   2 +-
 scripts/module.lds.S                          |   5 +-
 14 files changed, 759 insertions(+), 134 deletions(-)


base-commit: 651c8c1d735983040bec4f71d0e2e690f3c0fc2d
-- 
2.46.0.184.g6999bdac58-goog



             reply	other threads:[~2024-08-19 15:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 15:15 Suren Baghdasaryan [this message]
2024-08-19 15:15 ` [PATCH 1/5] alloc_tag: load module tags into separate continuous memory Suren Baghdasaryan
2024-08-20  7:13   ` Mike Rapoport
2024-08-20  7:26     ` Suren Baghdasaryan
2024-08-20 11:10     ` Kent Overstreet
2024-08-20 15:31   ` Liam R. Howlett
2024-08-20 18:35     ` Suren Baghdasaryan
2024-08-19 15:15 ` [PATCH 2/5] alloc_tag: eliminate alloc_tag_ref_set Suren Baghdasaryan
2024-08-19 15:15 ` [PATCH 3/5] alloc_tag: introduce pgalloc_tag_ref to abstract page tag references Suren Baghdasaryan
2024-08-19 15:15 ` [PATCH 4/5] alloc_tag: make page allocation tag reference size configurable Suren Baghdasaryan
2024-08-19 15:15 ` [PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags Suren Baghdasaryan
2024-08-19 19:34   ` Matthew Wilcox
2024-08-19 20:39     ` Suren Baghdasaryan
2024-08-19 20:40       ` Matthew Wilcox
2024-08-20  1:46         ` Andrew Morton
2024-08-20  2:21           ` Suren Baghdasaryan

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=20240819151512.2363698-1-surenb@google.com \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave@stgolabs.net \
    --cc=david@redhat.com \
    --cc=dennis@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jhubbard@nvidia.com \
    --cc=kaleshsingh@google.com \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@linux.dev \
    --cc=kernel-team@android.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mhocko@suse.com \
    --cc=minchan@google.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=paulmck@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=souravpanda@google.com \
    --cc=tglx@linutronix.de \
    --cc=thuth@redhat.com \
    --cc=vbabka@suse.cz \
    --cc=vvvvvv@google.com \
    --cc=willy@infradead.org \
    --cc=xiongwei.song@windriver.com \
    --cc=yuzhao@google.com \
    /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