From: Oscar Salvador <osalvador@suse.de>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Michal Hocko <mhocko@suse.com>, Marco Elver <elver@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Alexander Potapenko <glider@google.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Subject: Re: [PATCH v2 2/2] mm,page_owner: Fix accounting of pages when migrating
Date: Thu, 21 Mar 2024 12:54:08 +0100 [thread overview]
Message-ID: <Zfwf4Ei_DJVSytbR@localhost.localdomain> (raw)
In-Reply-To: <e291e52a-ae98-42ac-88c3-7463f952d490@suse.cz>
On Thu, Mar 21, 2024 at 12:20:24PM +0100, Vlastimil Babka wrote:
> Understood, but migration is kinda heavy and non-fast-path operation already
> so the extra lookup wouldn't be in a critical fast path.
Ok, you convinced me, let us save that memory.
> When I mean is we have __set_page_owner_handle() setting up everything for
> tail pages and then we have __folio_copy_owner updating only the head page,
> so this will create kinda a mixed up information. Which might not be an
> issue as __folio_copy_owner() should mean it's a proper folio thus compound
> page thus nobody ever will check those mismatched tail pages... Maybe we
> could adjust __set_page_owner_handle() to skip tail pages for compound
> pages as well and unify this, and tail pages would be only setup for those
> weird high-order non-compound pages so that the odd case in __free_pages()
> works?
>
> Or maybe page_owner is considered debugging functionality enough so it might
> be worth having the redundant data in tail pages in case something goes
> wrong. But either way now it seems we're not doing it consistently.
So we basically have two options here, 1) is to also update tail pages
in __folio_copy_owner, and 2) is to follow __folio_copy_owner example
and skip tail pages in __set_page_owner.
The thing is, going with 2) might mean, as you pointed out, that if
something goes wrong we lose the information for those pages as
page_owner does not have a record for them.
OTOH, would that information be really useful? Sure we could see the stack, but
AFAICS not even the migrate_reason would be recorded in those tail
pages, which means that if they are migrated and freed, we would only
see that they were freed. (the free stack would point to the migrate
code though, so that is a hint).
Not really sure which path to take here, skipping tail pages would be
less of a complexity but at a risk of loosing information.
Anyway, let me first tackle the issue at hand here, and then I will
think more about that.
Thanks!
--
Oscar Salvador
SUSE Labs
prev parent reply other threads:[~2024-03-21 11:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 18:32 [PATCH v2 0/2] page_owner: Refcount fixups Oscar Salvador
2024-03-19 18:32 ` [PATCH v2 1/2] mm,page_owner: Fix refcount imbalance Oscar Salvador
2024-03-19 23:24 ` Andrew Morton
2024-03-20 4:40 ` Tetsuo Handa
2024-03-20 5:49 ` Oscar Salvador
2024-03-20 9:42 ` Tetsuo Handa
2024-03-20 17:35 ` kernel test robot
2024-03-20 23:37 ` kernel test robot
2024-03-21 10:36 ` Vlastimil Babka
2024-03-19 18:32 ` [PATCH v2 2/2] mm,page_owner: Fix accounting of pages when migrating Oscar Salvador
2024-03-19 18:48 ` Matthew Wilcox
2024-03-20 5:00 ` Oscar Salvador
2024-03-21 10:50 ` Vlastimil Babka
2024-03-21 11:07 ` Oscar Salvador
2024-03-21 11:20 ` Vlastimil Babka
2024-03-21 11:54 ` Oscar Salvador [this message]
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=Zfwf4Ei_DJVSytbR@localhost.localdomain \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--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;
as well as URLs for NNTP newsgroup(s).