public inbox for linux-hyperv@vger.kernel.org
 help / color / mirror / Atom feed
From: Mukesh R <mrathor@linux.microsoft.com>
To: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
	kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, longli@microsoft.com
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] mshv: Introduce hv_result_oom() helper function
Date: Fri, 23 Jan 2026 16:31:43 -0800	[thread overview]
Message-ID: <6bca523f-4133-948c-71bf-24475e7292a7@linux.microsoft.com> (raw)
In-Reply-To: <176913211358.89165.15502151782362191256.stgit@skinsburskii-cloud-desktop.internal.cloudapp.net>

On 1/22/26 17:35, Stanislav Kinsburskii wrote:
> Replace direct comparisons of hv_result(status) against
> HV_STATUS_INSUFFICIENT_MEMORY with a new hv_result_oom() helper function.
> This improves code readability and provides a consistent and extendable
> interface for checking out-of-memory conditions in hypercall results.
> 
> No functional changes intended.
> 
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
> ---
>   drivers/hv/hv_proc.c           |   14 ++++++++++++--
>   drivers/hv/mshv_root_hv_call.c |   20 ++++++++++----------
>   drivers/hv/mshv_root_main.c    |    2 +-
>   include/asm-generic/mshyperv.h |    3 +++
>   4 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/hv/hv_proc.c b/drivers/hv/hv_proc.c
> index fbb4eb3901bb..80c66d1c74d5 100644
> --- a/drivers/hv/hv_proc.c
> +++ b/drivers/hv/hv_proc.c
> @@ -110,6 +110,16 @@ int hv_call_deposit_pages(int node, u64 partition_id, u32 num_pages)
>   }
>   EXPORT_SYMBOL_GPL(hv_call_deposit_pages);
>   
> +bool hv_result_oom(u64 status)
> +{
> +	switch (hv_result(status)) {
> +	case HV_STATUS_INSUFFICIENT_MEMORY:
> +		return true;
> +	}
> +	return false;
> +}
> +EXPORT_SYMBOL_GPL(hv_result_oom);

I had mentioned this during internal review previously, so forgive me
for repeating. I don't think using _oom suffix is a good idea. Firstly,
system is not out of memory, hypervisor will continue to work perfectly,
just the particalur hypercall needs a bit more ram to succeed. Secondly
and more importantly, "oom" has come to mean a very specific event
in linux, and as such reusing it for something totally different is
unnecessary. For example, if another maintainer working on oom happens
to see this, and not being familiar with HyperV may get totally confused
and waste time unnecessarily.

It can easily be renamed: hv_result_insuff_mem, or hv_result_enomem,
or hv_result_deposit_ram etc... there are many options.

Thanks,
-Mukesh

.... deleted ...


  reply	other threads:[~2026-01-24  0:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  1:35 [PATCH 0/4] Improve Hyper-V memory deposit error handling Stanislav Kinsburskii
2026-01-23  1:35 ` [PATCH 1/4] mshv: Introduce hv_result_oom() helper function Stanislav Kinsburskii
2026-01-24  0:31   ` Mukesh R [this message]
2026-01-23  1:35 ` [PATCH 2/4] mshv: Introduce hv_deposit_memory helper functions Stanislav Kinsburskii
2026-01-24  0:33   ` Mukesh R
2026-01-25 22:41     ` Stanislav Kinsburskii
2026-01-27  2:06       ` Mukesh R
2026-01-27 18:30         ` Stanislav Kinsburskii
2026-01-27 19:44           ` Mukesh R
2026-01-28 23:18             ` Stanislav Kinsburskii
2026-01-30  2:49               ` Mukesh R
2026-01-23  1:35 ` [PATCH 3/4] mshv: Handle insufficient contiguous memory hypervisor status Stanislav Kinsburskii
2026-01-23  1:35 ` [PATCH 4/4] mshv: Handle insufficient root memory hypervisor statuses Stanislav Kinsburskii

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=6bca523f-4133-948c-71bf-24475e7292a7@linux.microsoft.com \
    --to=mrathor@linux.microsoft.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=skinsburskii@linux.microsoft.com \
    --cc=wei.liu@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