Re: [PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags

2024-08-19 Thread Suren Baghdasaryan
On Mon, Aug 19, 2024 at 6:46 PM Andrew Morton wrote: > > On Mon, 19 Aug 2024 21:40:34 +0100 Matthew Wilcox wrote: > > > On Mon, Aug 19, 2024 at 01:39:16PM -0700, Suren Baghdasaryan wrote: > > > On Mon, Aug 19, 2024 at 12:34 PM Matthew Wilcox > > > wrote: > > > > So if ALLOC_TAG_REF_WIDTH is big

Re: [PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags

2024-08-19 Thread Andrew Morton
On Mon, 19 Aug 2024 21:40:34 +0100 Matthew Wilcox wrote: > On Mon, Aug 19, 2024 at 01:39:16PM -0700, Suren Baghdasaryan wrote: > > On Mon, Aug 19, 2024 at 12:34 PM Matthew Wilcox wrote: > > > So if ALLOC_TAG_REF_WIDTH is big enough, it's going to force last_cpupid > > > into struct page. > > >

Re: [PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags

2024-08-19 Thread Matthew Wilcox
On Mon, Aug 19, 2024 at 01:39:16PM -0700, Suren Baghdasaryan wrote: > On Mon, Aug 19, 2024 at 12:34 PM Matthew Wilcox wrote: > > So if ALLOC_TAG_REF_WIDTH is big enough, it's going to force last_cpupid > > into struct page. > > Thanks for taking a look! > Yes, but how is this field different from

Re: [PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags

2024-08-19 Thread Suren Baghdasaryan
On Mon, Aug 19, 2024 at 12:34 PM Matthew Wilcox wrote: > > On Mon, Aug 19, 2024 at 08:15:11AM -0700, Suren Baghdasaryan wrote: > > @@ -91,7 +97,7 @@ > > #endif > > > > #if ZONES_WIDTH + LRU_GEN_WIDTH + SECTIONS_WIDTH + NODES_WIDTH + \ > > - KASAN_TAG_WIDTH + LAST_CPUPID_SHIFT <= BITS_PER_LON

Re: [PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags

2024-08-19 Thread Matthew Wilcox
On Mon, Aug 19, 2024 at 08:15:11AM -0700, Suren Baghdasaryan wrote: > @@ -91,7 +97,7 @@ > #endif > > #if ZONES_WIDTH + LRU_GEN_WIDTH + SECTIONS_WIDTH + NODES_WIDTH + \ > - KASAN_TAG_WIDTH + LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS > + KASAN_TAG_WIDTH + ALLOC_TAG_REF_WIDTH + LAS

[PATCH 5/5] alloc_tag: config to store page allocation tag refs in page flags

2024-08-19 Thread Suren Baghdasaryan
Add CONFIG_PGALLOC_TAG_USE_PAGEFLAGS to store allocation tag references directly in the page flags. This removes dependency on page_ext and results in better performance for page allocations as well as reduced page_ext memory overhead. CONFIG_PGALLOC_TAG_REF_BITS controls the number of bits require

[PATCH 4/5] alloc_tag: make page allocation tag reference size configurable

2024-08-19 Thread Suren Baghdasaryan
Introduce CONFIG_PGALLOC_TAG_REF_BITS to control the size of the page allocation tag references. When the size is configured to be less than a direct pointer, the tags are searched using an index stored as the tag reference. Signed-off-by: Suren Baghdasaryan --- include/linux/alloc_tag.h | 10

[PATCH 3/5] alloc_tag: introduce pgalloc_tag_ref to abstract page tag references

2024-08-19 Thread Suren Baghdasaryan
To simplify later changes to page tag references, introduce new pgalloc_tag_ref and pgtag_ref_handle types. This allows easy replacement of page_ext as a storage of page allocation tags Signed-off-by: Suren Baghdasaryan --- include/linux/pgalloc_tag.h | 144 +++-

[PATCH 2/5] alloc_tag: eliminate alloc_tag_ref_set

2024-08-19 Thread Suren Baghdasaryan
To simplify further refactoring, open-code the only two callers of alloc_tag_ref_set(). Signed-off-by: Suren Baghdasaryan --- include/linux/alloc_tag.h | 25 ++--- include/linux/pgalloc_tag.h | 12 +++- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git

[PATCH 1/5] alloc_tag: load module tags into separate continuous memory

2024-08-19 Thread Suren Baghdasaryan
When a module gets unloaded there is a possibility that some of the allocations it made are still used and therefore the allocation tags corresponding to these allocations are still referenced. As such, the memory for these tags can't be freed. This is currently handled as an abnormal situation and

[PATCH 0/5] page allocation tag compression

2024-08-19 Thread Suren Baghdasaryan
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