linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Oscar Salvador <osalvador@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>,
	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: Tue, 19 Mar 2024 18:48:31 +0000	[thread overview]
Message-ID: <Zfnd_w0ZLOVhgACt@casper.infradead.org> (raw)
In-Reply-To: <20240319183212.17156-3-osalvador@suse.de>

On Tue, Mar 19, 2024 at 07:32:12PM +0100, Oscar Salvador wrote:
> Upon migration, new allocated pages are being given the handle of the old
> pages. This is problematic because it means that for the stack which
> allocated the old page, we will be substracting the old page + the new one
> when that page is freed, creating an accounting imbalance.
> 
> Fix this by adding a new migrate_handle in the page_owner struct, and
> record the handle that allocated the new page in __folio_copy_owner().
> Upon freeing, we check whether we have a migrate_handle, and if we do,
> we use migrate_handle for dec_stack_record_count(), which will
> subtract those pages from its right handle.

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.


  reply	other threads:[~2024-03-19 18:48 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 [this message]
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

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=Zfnd_w0ZLOVhgACt@casper.infradead.org \
    --to=willy@infradead.org \
    --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=osalvador@suse.de \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=vbabka@suse.cz \
    /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).