linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Yuvraj Sakshith <yuvraj.sakshith@oss.qualcomm.com>,
	akpm@linux-foundation.org, mst@redhat.com
Cc: vbabka@suse.cz, surenb@google.com, mhocko@suse.com,
	jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com,
	linux-mm@kvack.org, jasowang@redhat.com,
	xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
	virtualization@lists.linux.dev, kys@microsoft.com,
	haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	longli@microsoft.com, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] virtio_balloon: Set pr_dev.order to new default
Date: Thu, 26 Feb 2026 18:43:42 +0100	[thread overview]
Message-ID: <d9294aae-b91d-42b4-9e8c-cc63245a3f43@kernel.org> (raw)
In-Reply-To: <20260226070125.3732265-4-yuvraj.sakshith@oss.qualcomm.com>

On 2/26/26 08:01, Yuvraj Sakshith wrote:
> Drivers registering with page reporting used zero
> as a way to signal page_reporting_order to be set
> as a default value (either passed as a param or
> MAX_PAGE_ORDER).
> 
> Since page_reporting_order can now have zero as
> valid order, default fallback value send by drivers
> to page reporting is now -1.
> 
> Signed-off-by: Yuvraj Sakshith <yuvraj.sakshith@oss.qualcomm.com>
> ---
>  drivers/virtio/virtio_balloon.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 74fe59f5a..3cc3dc28a 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -1044,6 +1044,20 @@ static int virtballoon_probe(struct virtio_device *vdev)
>  			goto out_unregister_oom;
>  		}
>  
> +		/*
> +		 * page_reporting_register() takes the order either
> +		 * from the driver or the commandline. If neither
> +		 * are provided, it falls back to MAX_PAGE_ORDER.
> +		 *
> +		 * Order given by the driver is required to be in the
> +		 * range [0, MAX_PAGE_ORDER].
> +		 *
> +		 * One way for the driver to not provide any order
> +		 * is by setting it to -1.
> +		 */
> +
> +		vb->pr_dev_info.order = -1;

That overly-long comment indicates that we can do better.


What about the following:

Patch #1: Introduce PAGE_REPORTING_DEFAULT_ORDER

diff --git a/include/linux/page_reporting.h b/include/linux/page_reporting.h
index fe648dfa3a7c..3e21bfbb49a4 100644
--- a/include/linux/page_reporting.h
+++ b/include/linux/page_reporting.h
@@ -8,6 +8,9 @@
 /* This value should always be a power of 2, see page_reporting_cycle() */
 #define PAGE_REPORTING_CAPACITY                32
 
+/* Specifying this value as minimal reporting order selects the default. */
+#define PAGE_REPORTING_DEFAULT_ORDER   0
+
 struct page_reporting_dev_info {
        /* function that alters pages to make them "reported" */
        int (*report)(struct page_reporting_dev_info *prdev,
diff --git a/mm/page_reporting.c b/mm/page_reporting.c
index f0042d5743af..d5191cb6b31c 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -370,7 +370,8 @@ int page_reporting_register(struct page_reporting_dev_info *prdev)
         */
 
        if (page_reporting_order == -1) {
-               if (prdev->order > 0 && prdev->order <= MAX_PAGE_ORDER)
+               if (prdev->order != PAGE_REPORTING_DEFAULT_ORDER &&
+                   prdev->order <= MAX_PAGE_ORDER)
                        page_reporting_order = prdev->order;
                else
                        page_reporting_order = pageblock_order;


Patch #2: Use the define in hyperv

Patch #3: Use the define in virtio-balloon

Patch #4: Change PAGE_REPORTING_DEFAULT_ORDER to "MAX_PAGE_ORDER + 1" or sth. like that.


Then I think you can just drop the comment in virtballoon_probe() completely.

-- 
Cheers,

David


      reply	other threads:[~2026-02-26 17:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  7:01 [PATCH 0/3] Allow order zero pages in page reporting Yuvraj Sakshith
2026-02-26  7:01 ` [PATCH 1/3] mm/page_reporting: Allow zero page_reporting_order Yuvraj Sakshith
2026-02-26  7:01 ` [PATCH 2/3] hv_balloon: Change default page reporting order Yuvraj Sakshith
2026-02-26 17:34   ` David Hildenbrand (Arm)
2026-02-26  7:01 ` [PATCH 3/3] virtio_balloon: Set pr_dev.order to new default Yuvraj Sakshith
2026-02-26 17:43   ` David Hildenbrand (Arm) [this message]

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=d9294aae-b91d-42b4-9e8c-cc63245a3f43@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=decui@microsoft.com \
    --cc=eperezma@redhat.com \
    --cc=haiyangz@microsoft.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longli@microsoft.com \
    --cc=mhocko@suse.com \
    --cc=mst@redhat.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=virtualization@lists.linux.dev \
    --cc=wei.liu@kernel.org \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yuvraj.sakshith@oss.qualcomm.com \
    --cc=ziy@nvidia.com \
    /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