public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jason Andryuk <jason.andryuk@amd.com>
Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	James Dingwall <james@dingwall.me.uk>,
	Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Subject: Re: [PATCH] Partial revert "x86/xen: fix balloon target initialization for PVH dom0"
Date: Thu, 22 Jan 2026 18:46:15 +0100	[thread overview]
Message-ID: <aXJiZ4zKvHzlg6dB@Mac.lan> (raw)
In-Reply-To: <1357dda0-bb5d-4f59-a53c-d584099bf65c@amd.com>

On Thu, Jan 22, 2026 at 12:03:47PM -0500, Jason Andryuk wrote:
> On 2026-01-22 11:57, Roger Pau Monné wrote:
> > On Thu, Jan 22, 2026 at 09:40:01AM -0500, Jason Andryuk wrote:
> > > On 2026-01-21 12:49, Roger Pau Monné wrote:
> > > > I haven't tested it yet to see whether that's OK to do on PV, I would
> > > > think PV and PVH would be the same here, since the setting of the
> > > > xenstore target value is based in the return of
> > > > XENMEM_current_reservation for both.
> > > 
> > > On a system with 32GB and dom0=pvh dom0_mem=7G:
> > > 
> > > [    0.295201] xen:balloon: current_pages: 1835007 get_num_physpages 8220126
> > > xen_released_pages 6385120
> > > [    0.295201] ------------[ cut here ]------------
> > > [    0.295201] Released pages underflow current target
> > > 
> > > 8220126 - 6385120 = 1835006
> > > 
> > > And also for PV:
> > > 
> > > [    1.406923] xen:balloon: current_pages: 1835008 get_num_physpages 8220127
> > > xen_released_pages 6385120
> > > [    1.406928] ------------[ cut here ]------------
> > > [    1.406931] Released pages underflow current target
> > > 
> > > 
> > > So we don't want to subtract xen_released_pages for dom0.  Is
> > > xen_released_pages expected to be non-zero for a domU?
> > 
> > Oh, yes.  In fact I think the patch here is wrong for PV dom0, as it
> > shouldn't subtract xen_released_pages from xen_start_info->nr_pages.
> > I will need to send v2.
> 
> To be clear, the numbers and warning are from the follow on
> current_reservation patch.

Yes, but I think it's also bad to use xen_start_info->nr_pages -
xen_released_pages (my current proposal).  xen_released_pages had a
different meaning on PV which I kind of stolen for the unpopulated
alloc work.  It was originally meant to signal pages that are freed
during the boot process when it's not possible to relocate them; see
xen_set_identity_and_release_chunk.  Unpopulated alloc doesn't free
the pages it uses, because they are already free to start with.

I think I need to introduce a new counter that accounts for pages
consumed by unpopulated alloc strictly, and not re-use the
xen_released_pages counter.

All this memory accounting is far more complex than it should be
sadly.

Thanks, Roger.

  reply	other threads:[~2026-01-22 17:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 14:06 [PATCH] Partial revert "x86/xen: fix balloon target initialization for PVH dom0" Roger Pau Monne
2026-01-20 15:33 ` Roger Pau Monné
2026-01-20 20:10 ` Jason Andryuk
2026-01-21 11:17   ` Roger Pau Monné
2026-01-21 17:21     ` Jason Andryuk
2026-01-21 17:49       ` Roger Pau Monné
2026-01-22  7:17         ` Jan Beulich
2026-01-22  8:23           ` Roger Pau Monné
2026-01-22 14:40         ` Jason Andryuk
2026-01-22 16:57           ` Roger Pau Monné
2026-01-22 17:03             ` Jason Andryuk
2026-01-22 17:46               ` Roger Pau Monné [this message]
2026-01-21 11:03 ` James Dingwall

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=aXJiZ4zKvHzlg6dB@Mac.lan \
    --to=roger.pau@citrix.com \
    --cc=james@dingwall.me.uk \
    --cc=jason.andryuk@amd.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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