Thread (208 messages) 208 messages, 21 authors, 2024-02-29

Re: [PATCH v3 18/35] mm: create new codetag references during page splitting

From: Suren Baghdasaryan <surenb@google.com>
Date: 2024-02-18 00:44:18
Also in: cgroups, linux-arch, linux-doc, linux-fsdevel, linux-iommu, linux-mm, lkml

On Fri, Feb 16, 2024 at 4:46 PM Suren Baghdasaryan [off-list ref] wrote:
On Fri, Feb 16, 2024 at 6:33 AM Vlastimil Babka [off-list ref] wrote:
quoted
On 2/12/24 22:39, Suren Baghdasaryan wrote:
quoted
When a high-order page is split into smaller ones, each newly split
page should get its codetag. The original codetag is reused for these
pages but it's recorded as 0-byte allocation because original codetag
already accounts for the original high-order allocated page.
Wouldn't it be possible to adjust the original's accounted size and
redistribute to the split pages for more accuracy?
I can't recall why I didn't do it that way but I'll try to change and
see if something non-obvious comes up. Thanks!
Ok, now I recall what's happening here. alloc_tag_add() effectively
does two things:
1. it sets reference to point to the tag (ref->ct = &tag->ct)
2. it increments tag->counters

In pgalloc_tag_split() by calling
alloc_tag_add(codetag_ref_from_page_ext(page_ext), tag, 0); we
effectively set the reference from new page_ext to point to the
original tag but we keep the tag->counters->bytes counter the same
(incrementing by 0). It still increments tag->counters->calls but I
think we need that because when freeing individual split pages we will
be decrementing this counter for each individual page. We allocated
many pages with one call, then split into smaller pages and will be
freeing them with multiple calls. We need to balance out the call
counter during the split.

I can refactor the part of alloc_tag_add() that sets the reference
into a separate alloc_tag_ref_set() and make it set the reference and
increments tag->counters->calls (with a comment explaining why we need
this increment here). Then I can call alloc_tag_ref_set() from inside
alloc_tag_add() and when splitting  pages. I think that will be a bit
more clear.
quoted
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help