From: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
To: David Hildenbrand <david@redhat.com>, Nadav Amit <nadav.amit@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
kernel@openvz.org,
Linux Virtualization <virtualization@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>
Subject: Re: RFC [PATCH v4 2/7] Enable balloon drivers to report inflated memory
Date: Fri, 14 Oct 2022 16:33:06 +0300 [thread overview]
Message-ID: <5b1e0a13-8018-630d-d512-c3033db2f2e3@virtuozzo.com> (raw)
In-Reply-To: <72e535ce-80eb-a02f-970c-6a9c80da0a24@redhat.com>
On 14.10.22 16:01, David Hildenbrand wrote:
> On 14.10.22 14:50, Alexander Atanasov wrote:
>> Hello,
>>
>> On 11.10.22 12:23, David Hildenbrand wrote:
>>>>>>> Sounds to me that all you want is some notifier to be called from
>>>>>>> adjust_managed_page_count(). What am I missing?
>>>>>>
>>>>>> Notifier will act as an accumulator to report size of change and it
>>>>>> will make things easier for the drivers and users wrt locking.
>>>>>> Notifier is similar to the memory hotplug notifier.
>>>>>
>>>>> Overall, I am not convinced that there is any value of separating the
>>>>> value
>>>>> and the notifier. You can batch both or not batch both. In addition,
>>>>> as I
>>>>> mentioned, having two values seems racy.
>>>>
>>>> I have identified two users so far above - may be more to come.
>>>> One type needs the value to adjust. Also having the value is necessary
>>>> to report it to users and oom. There are options with callbacks and so
>>>> on but it will complicate things with no real gain. You are right about
>>>> the atomicity but i guess if that's a problem for some user it could
>>>> find a way to ensure it. i am yet to find such place.
>>>>
>>>
>>> I haven't followed the whole discussion, but I just wanted to raise that
>>> having a generic mechanism to notify on such changes could be valuable.
>>>
>>> For example, virtio-mem also uses adjust_managed_page_count() and might
>>> sometimes not trigger memory hotplug notifiers when adding more memory
>>> (essentially, when it fake-adds memory part of an already added Linux
>>> memory block).
>>>
>>> What might make sense is schedule some kind of deferred notification on
>>> adjust_managed_page_count() changes. This way, we could notify without
>>> caring about locking and would naturally batch notifications.
>>>
>>> adjust_managed_page_count() users would not require changes.
>>
>> Making it deferred will bring issues for both the users of the
>> adjust_managed_page_count and the receivers of the notification -
>> locking as first. And it is hard to know when the adjustment will
>> finish, some of the drivers wait and retry in blocks. It will bring
>> complexity and it will not be possible to convert users in small steps.
>
> What exactly is the issue about handling that deferred? Who needs an
> immediate, 100% precise notification? >
> Locking from a separate workqueue shouldn't be too hard, or what am i
> missing?
>
We do not need immediate but most of the current callers of
adjust_managed_page_count work in +1/-1 updates - so we want to defer
the notification until they are done with changes. Deferring to a wq is
not the problem, it would need to be done most likely.
>>
>> Other problem is that there are drivers that do not use
>> adjust_managed_page_count().
>
> Which ones? Do we care?
VMWare and Virtio balloon drivers. I recently proposed to unify them and
the objection was that it would break existing users - which is valid so
we must care i guess.
--
Regards,
Alexander Atanasov
next prev parent reply other threads:[~2022-10-14 13:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221005090158.2801592-1-alexander.atanasov@virtuozzo.com>
2022-10-05 9:01 ` [PATCH v4 1/7] Make place for common balloon code Alexander Atanasov
2022-10-05 9:01 ` [PATCH v4 2/7] Enable balloon drivers to report inflated memory Alexander Atanasov
2022-10-05 17:25 ` Nadav Amit
2022-10-06 7:34 ` Alexander Atanasov
2022-10-06 21:07 ` Nadav Amit
2022-10-07 10:58 ` RFC " Alexander Atanasov
2022-10-10 6:18 ` Nadav Amit
2022-10-10 7:24 ` Alexander Atanasov
2022-10-10 14:47 ` Nadav Amit
2022-10-11 9:07 ` Alexander Atanasov
2022-10-11 9:23 ` David Hildenbrand
2022-10-14 12:50 ` Alexander Atanasov
2022-10-14 13:01 ` David Hildenbrand
2022-10-14 13:33 ` Alexander Atanasov [this message]
2022-10-14 13:40 ` David Hildenbrand
2022-10-14 14:10 ` Alexander Atanasov
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=5b1e0a13-8018-630d-d512-c3033db2f2e3@virtuozzo.com \
--to=alexander.atanasov@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=kernel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mst@redhat.com \
--cc=nadav.amit@gmail.com \
--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