linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nadav Amit <namit@vmware.com>
To: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
Cc: Pv-drivers <Pv-drivers@vmware.com>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"kernel@openvz.org" <kernel@openvz.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v5 6/8] drivers: vmware: balloon - report inflated memory
Date: Fri, 21 Oct 2022 06:50:33 +0000	[thread overview]
Message-ID: <39FA848F-290D-4110-B27C-8822377E6AA5@vmware.com> (raw)
In-Reply-To: <20221019095620.124909-7-alexander.atanasov@virtuozzo.com>

On Oct 19, 2022, at 12:56 PM, Alexander Atanasov <alexander.atanasov@virtuozzo.com> wrote:

> Update the inflated memory in the mm core on change.
> 
> Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
> ---
> drivers/misc/vmw_balloon.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index 91d4d2a285c5..3bfd845898f5 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -1507,6 +1507,7 @@ static void vmballoon_work(struct work_struct *work)
> 	queue_delayed_work(system_freezable_wq,
> 			   dwork, round_jiffies_relative(HZ));
> 
> +	balloon_set_inflated_free(atomic64_read(&b->size) << 2);
> }

I don’t like it in general (I think that something like that should go into
some common infra).

But more concretely there are at least 2 problems here. First, queueing the
work should come last. Second, there are other places that change the
balloon size (e.g., vmballoon_reset()), which are not handled by this patch.

If you added calls to balloon_set_inflated_free() from these places, you can
get races while calling balloon_set_inflated_free() and the last value that
would be latched would be the wrong one. I don’t see anything in the logic
or comments that clarify how something like that should be resolved.


  parent reply	other threads:[~2022-10-21  6:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221019095620.124909-1-alexander.atanasov@virtuozzo.com>
2022-10-19  9:56 ` [RFC PATCH v5 1/8] mm: Make a place for a common balloon code Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 2/8] mm: Enable balloon drivers to report inflated memory Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 3/8] mm: Display inflated memory to users Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 4/8] mm: Display inflated memory in logs Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 5/8] drivers: virtio: balloon - report inflated memory Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 6/8] drivers: vmware: " Alexander Atanasov
2022-10-19 10:26   ` Greg Kroah-Hartman
2022-10-19 10:38     ` Alexander Atanasov
2022-10-19 10:49       ` Greg Kroah-Hartman
2022-10-19 11:06         ` Alexander Atanasov
2022-10-21  6:50   ` Nadav Amit [this message]
2022-10-21  7:25     ` Alexander Atanasov
2022-10-21  7:31       ` Nadav Amit
2022-10-21  8:02         ` Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 7/8] drivers: hyperv: " Alexander Atanasov
2022-10-19  9:56 ` [RFC PATCH v5 8/8] documentation: create a document about how balloon drivers operate Alexander Atanasov
2022-10-19 13:53   ` Jonathan Corbet

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=39FA848F-290D-4110-B27C-8822377E6AA5@vmware.com \
    --to=namit@vmware.com \
    --cc=Pv-drivers@vmware.com \
    --cc=alexander.atanasov@virtuozzo.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@openvz.org \
    --cc=linux-kernel@vger.kernel.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).