[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed41d5cf-d068-412d-b7bb-5468df2fefb7@suse.cz>
Date: Thu, 21 Mar 2024 11:50:36 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Oscar Salvador <osalvador@...e.de>, Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Michal Hocko <mhocko@...e.com>,
Marco Elver <elver@...gle.com>, Andrey Konovalov <andreyknvl@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Subject: Re: [PATCH v2 2/2] mm,page_owner: Fix accounting of pages when
migrating
On 3/20/24 06:00, Oscar Salvador wrote:
> On Tue, Mar 19, 2024 at 06:48:31PM +0000, Matthew Wilcox wrote:
>> Is this the right way to fix this problem? I would have thought we'd
>> be better off accounting this as migration freeing the old page and
>> allocating the new page. If I understand correctly, this is the code
>> which says "This page was last allocated by X and freed by Y", and I
>> would think that being last freed (or allocated) by the migration code
>> would be a very nice hint about where a problem might stem from.
>
> I hear you, and I had the same thought when I stumbled upon this.
> I did not know that the handle was being changed, otherwise it would
> have saved me quite a lot of debugging time.
>
> Checking the history of this, I can see this decision was made in
> 2016 in:
>
> commit d435edca928805074dae005ab9a42d9fa60fc702
> Author: Vlastimil Babka <vbabka@...e.cz>
> Date: Tue Mar 15 14:56:15 2016 -0700
>
> mm, page_owner: copy page owner info during migration
>
Yeah I think we could keep that logic.
But we could also simply subtract the refcount of the old handle (the
"allocated for migration") in __folio_copy_owner() no? Then we wouldn't need
the extra migrate_handle.
Also we might have more issues here. Most page owner code takes care to set
everything for all pages within a folio, but __folio_copy_owner() and
__set_page_owner_migrate_reason() don't.
Powered by blists - more mailing lists