Re: [PATCH 1/2] xen/mm: Alter get_outstanding_claims() to return information by value
Jan Beulich <[email protected]> Mon, 3 Aug 2026 14:34:56 +0200
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <[email protected]> |
On 03.08.2026 14:17, Andrew Cooper wrote:
> A void function with two output parameters is a weird choice. Instead, return
> a two-element structure.
Hmm. Generally in reviews I'm trying to recommend against returning of structures
by value. I don't like this very much here either, and it is (slightly) harder to
use ...
> --- a/xen/common/sysctl.c
> +++ b/xen/common/sysctl.c
> @@ -248,6 +248,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
> case XEN_SYSCTL_physinfo:
> {
> struct xen_sysctl_physinfo *pi = &op->u.physinfo;
> + claim_info_t claim_info;
>
> memset(pi, 0, sizeof(*pi));
> pi->threads_per_core =
> @@ -259,8 +260,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
> pi->max_node_id = MAX_NUMNODES-1;
> pi->max_cpu_id = nr_cpu_ids - 1;
> pi->total_pages = total_pages;
> - /* Protected by lock */
> - get_outstanding_claims(&pi->free_pages, &pi->outstanding_pages);
> +
> + claim_info = get_outstanding_claims();
> + pi->free_pages = claim_info.avail;
> + pi->outstanding_pages = claim_info.claimed;
... here. If others think this is the way to go, so be it. But I'm not in favor.
Jan