linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] page allocation tag compression
@ 2024-09-02  4:41 Suren Baghdasaryan
  2024-09-02  4:41 ` [PATCH v2 1/6] maple_tree: add mas_for_each_rev() helper Suren Baghdasaryan
                   ` (5 more replies)
  0 siblings, 6 replies; 27+ messages in thread
From: Suren Baghdasaryan @ 2024-09-02  4:41 UTC (permalink / raw)
  To: akpm
  Cc: kent.overstreet, corbet, arnd, mcgrof, rppt, paulmck, thuth,
	tglx, bp, xiongwei.song, ardb, david, vbabka, mhocko, hannes,
	roman.gushchin, dave, willy, liam.howlett, pasha.tatashin,
	souravpanda, keescook, dennis, jhubbard, yuzhao, vvvvvv, rostedt,
	iamjoonsoo.kim, rientjes, minchan, kaleshsingh, linux-doc,
	linux-kernel, linux-arch, linux-mm, linux-modules, kernel-team,
	surenb

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 introduces mas_for_each_rev() helper function.

Patch #2 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 #3 is a code cleanup to simplify later changes.

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

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

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

Patchset applies to mm-unstable.

Changes since v1 [1]:
- introduced mas_for_each_rev() and use it, per Liam Howlett
- use advanced maple_tree API to minimize lookups, per Liam Howlett
- fixed CONFIG_MODULES=n configuration build, per kernel test robot

[1] https://lore.kernel.org/all/20240819151512.2363698-1-surenb@google.com/

Suren Baghdasaryan (6):
  maple_tree: add mas_for_each_rev() helper
  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                       |  40 ++-
 include/linux/maple_tree.h                    |  14 +
 include/linux/mmzone.h                        |   3 +
 include/linux/page-flags-layout.h             |  10 +-
 include/linux/pgalloc_tag.h                   | 287 +++++++++++++---
 kernel/module/main.c                          |  67 ++--
 lib/Kconfig.debug                             |  36 +-
 lib/alloc_tag.c                               | 321 ++++++++++++++++--
 lib/codetag.c                                 | 104 +++++-
 mm/mm_init.c                                  |   1 +
 mm/page_ext.c                                 |   2 +-
 scripts/module.lds.S                          |   5 +-
 15 files changed, 826 insertions(+), 133 deletions(-)


base-commit: 18d35b7e30d5a217ff1cc976bb819e1aa2873301
-- 
2.46.0.469.g59c65b2a67-goog



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

end of thread, other threads:[~2024-09-04 21:07 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-02  4:41 [PATCH v2 0/6] page allocation tag compression Suren Baghdasaryan
2024-09-02  4:41 ` [PATCH v2 1/6] maple_tree: add mas_for_each_rev() helper Suren Baghdasaryan
2024-09-02  4:41 ` [PATCH v2 2/6] alloc_tag: load module tags into separate continuous memory Suren Baghdasaryan
2024-09-02  4:41 ` [PATCH v2 3/6] alloc_tag: eliminate alloc_tag_ref_set Suren Baghdasaryan
2024-09-02  4:41 ` [PATCH v2 4/6] alloc_tag: introduce pgalloc_tag_ref to abstract page tag references Suren Baghdasaryan
2024-09-02  4:41 ` [PATCH v2 5/6] alloc_tag: make page allocation tag reference size configurable Suren Baghdasaryan
2024-09-02  5:09   ` Andrew Morton
2024-09-04  1:07     ` Suren Baghdasaryan
2024-09-04  1:16       ` Kent Overstreet
2024-09-04  2:04         ` Suren Baghdasaryan
2024-09-04 16:25           ` Kent Overstreet
2024-09-04 16:35             ` Suren Baghdasaryan
2024-09-02  4:41 ` [PATCH v2 6/6] alloc_tag: config to store page allocation tag refs in page flags Suren Baghdasaryan
2024-09-02  5:16   ` Andrew Morton
2024-09-03 18:19     ` Suren Baghdasaryan
2024-09-04  1:25       ` John Hubbard
2024-09-04  2:05         ` John Hubbard
2024-09-04 16:08           ` Suren Baghdasaryan
2024-09-04 18:58             ` John Hubbard
2024-09-04 21:07               ` Suren Baghdasaryan
2024-09-04  2:18         ` Matthew Wilcox
2024-09-04 16:18           ` Suren Baghdasaryan
2024-09-04 16:21             ` Kent Overstreet
2024-09-04 16:35             ` Matthew Wilcox
2024-09-04 16:37               ` Kent Overstreet
2024-09-04 16:39                 ` Suren Baghdasaryan
2024-09-04  2:41         ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox