virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
Cc: virtualization@lists.linux-foundation.org, kernel@openvz.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/2] Unify how inflated memory is accounted in virtio balloon driver
Date: Tue, 9 Aug 2022 06:42:34 -0400	[thread overview]
Message-ID: <20220809063624-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220726141047.72913-1-alexander.atanasov@virtuozzo.com>

On Tue, Jul 26, 2022 at 02:10:47PM +0000, Alexander Atanasov wrote:
> Always account inflated memory as used for both cases - with and
> without deflate on oom. Do not change total ram which can confuse
> userspace and users.
> 
> Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>

I only noticed this patch accidentally since it looked like
part of discussion on an older patch.
Please do not do this, each version should be its own thread,
if you want to link to previous discussion provide a
cover letter and do it there.

> ---
>  drivers/virtio/virtio_balloon.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 97d3b29cb9f1..fa6ddec45fc4 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -244,9 +244,6 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
>  
>  		set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
>  		vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
> -		if (!virtio_has_feature(vb->vdev,
> -					VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> -			adjust_managed_page_count(page, -1);
>  		vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
>  	}
>  
> @@ -265,9 +262,6 @@ static void release_pages_balloon(struct virtio_balloon *vb,
>  	struct page *page, *next;
>  
>  	list_for_each_entry_safe(page, next, pages, lru) {
> -		if (!virtio_has_feature(vb->vdev,
> -					VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> -			adjust_managed_page_count(page, 1);
>  		list_del(&page->lru);
>  		put_page(page); /* balloon reference */
>  	}

We adjusted total ram with balloon usage for many years.  I don't think
we can just drop this accounting using "can confuse userspace" as a
justification - any userspace that's confused by this has been confused
since approximately forever.

> @@ -750,12 +744,9 @@ static void report_free_page_func(struct work_struct *work)
>  static int virtio_balloon_debug_show(struct seq_file *f, void *offset)
>  {
>  	struct virtio_balloon *vb = f->private;
> -	s64 num_pages = vb->num_pages << (VIRTIO_BALLOON_PFN_SHIFT - 10);
> +	u64 num_pages = vb->num_pages << (VIRTIO_BALLOON_PFN_SHIFT - 10);
>  
> -	if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> -		num_pages = -num_pages;
> -
> -	seq_printf(f, "inflated: %lld kB\n", num_pages);
> +	seq_printf(f, "inflated: %llu kB\n", num_pages);
>  
>  	return 0;

I don't much like it when patch 1 adds code only for patch 2 to drop it.

>  }
> -- 
> 2.25.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2022-08-09 10:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220705083638.29669-1-alexander.atanasov@virtuozzo.com>
2022-07-05  8:59 ` [PATCH v4 1/1] Create debugfs file with virtio balloon usage information Michael S. Tsirkin
     [not found]   ` <f6b46a29-0f65-9081-5228-a1028fea2bef@virtuozzo.com>
2022-08-09 10:35     ` Michael S. Tsirkin
2022-07-14 11:35 ` David Hildenbrand
     [not found]   ` <123b7518-b0c9-171c-9596-73654691ee58@virtuozzo.com>
2022-07-14 13:24     ` David Hildenbrand
     [not found]   ` <20220714132053.56323-1-alexander.atanasov@virtuozzo.com>
2022-07-18 11:35     ` [PATCH v5 " David Hildenbrand
     [not found]       ` <865e4da3-94fe-95dc-cbe3-161fa8c2146d@virtuozzo.com>
2022-07-25 11:36         ` David Hildenbrand
     [not found]           ` <20220726140831.72816-1-alexander.atanasov@virtuozzo.com>
2022-08-01 15:18             ` [PATCH v6 1/2] " David Hildenbrand
     [not found]               ` <3a5e60e8-a0d2-a1f1-28e9-e0b45069029a@virtuozzo.com>
2022-08-01 20:12                 ` David Hildenbrand
     [not found]                   ` <2dfad5c8-59d2-69a1-cc4c-d530c12ceea9@virtuozzo.com>
2022-08-02 13:48                     ` [RFC] how the ballooned memory should be accounted by the drivers inside the guests? (was:[PATCH v6 1/2] Create debugfs file with virtio balloon usage information) David Hildenbrand
     [not found]                       ` <7bfac48d-2e50-641b-6523-662ea4df0240@virtuozzo.com>
2022-08-09 10:03                         ` David Hildenbrand
     [not found]             ` <20220726141047.72913-1-alexander.atanasov@virtuozzo.com>
2022-08-01 15:13               ` [PATCH v6 2/2] Unify how inflated memory is accounted in virtio balloon driver David Hildenbrand
2022-08-09 10:42               ` Michael S. Tsirkin [this message]
2022-08-09 10:44             ` [PATCH v6 1/2] Create debugfs file with virtio balloon usage information Michael S. Tsirkin

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=20220809063624-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alexander.atanasov@virtuozzo.com \
    --cc=kernel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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).