All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: George Dunlap <george.dunlap@citrix.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 1/3] xen/sched: introduce cpupool_update_node_affinity()
Date: Mon, 15 Aug 2022 13:58:34 +0200	[thread overview]
Message-ID: <1e86164f-b08c-a9bd-3437-af569342cc1e@suse.com> (raw)
In-Reply-To: <9abc061b-2d98-ace8-af4b-0881a5737dd6@suse.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 2278 bytes --]

On 15.08.22 13:41, Jan Beulich wrote:
> On 15.08.2022 13:04, Juergen Gross wrote:
>> For updating the node affinities of all domains in a cpupool add a new
>> function cpupool_update_node_affinity().
>>
>> In order to avoid multiple allocations of cpumasks carve out memory
>> allocation and freeing from domain_update_node_affinity() into new
>> helpers, which can be used by cpupool_update_node_affinity().
>>
>> Modify domain_update_node_affinity() to take an additional parameter
>> for passing the allocated memory in and to allocate and free the memory
>> via the new helpers in case NULL was passed.
>>
>> This will help later to pre-allocate the cpumasks in order to avoid
>> allocations in stop-machine context.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> with the observation that ...
> 
>> --- a/xen/common/sched/core.c
>> +++ b/xen/common/sched/core.c
>> @@ -1824,9 +1824,28 @@ int vcpu_affinity_domctl(struct domain *d, uint32_t cmd,
>>       return ret;
>>   }
>>   
>> -void domain_update_node_affinity(struct domain *d)
>> +bool update_node_aff_alloc(struct affinity_masks *affinity)
>>   {
>> -    cpumask_var_t dom_cpumask, dom_cpumask_soft;
>> +    if ( !alloc_cpumask_var(&affinity->hard) )
>> +        return false;
>> +    if ( !alloc_cpumask_var(&affinity->soft) )
>> +    {
>> +        free_cpumask_var(affinity->hard);
>> +        return false;
>> +    }
>> +
>> +    return true;
>> +}
>> +
>> +void update_node_aff_free(struct affinity_masks *affinity)
>> +{
>> +    free_cpumask_var(affinity->soft);
>> +    free_cpumask_var(affinity->hard);
>> +}
>> +
>> +void domain_update_node_aff(struct domain *d, struct affinity_masks *affinity)
>> +{
>> +    struct affinity_masks masks = { };
> 
> ... the initializer doesn't really look to be needed here, just like
> you don't have one in cpupool_update_node_affinity(). The one thing
> I'm not sure about is whether old gcc might mis-report a potentially
> uninitialized variable with the initializer dropped ...

Hmm, yes, I think the initializer was needed only in V1.

I guess you could remove it while committing in case no respin of the
series is needed otherwise?


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2022-08-15 11:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 11:04 [PATCH v2 0/3] xen/sched: fix cpu hotplug Juergen Gross
2022-08-15 11:04 ` [PATCH v2 1/3] xen/sched: introduce cpupool_update_node_affinity() Juergen Gross
2022-08-15 11:41   ` Jan Beulich
2022-08-15 11:58     ` Juergen Gross [this message]
2022-08-15 12:01       ` Jan Beulich
2022-08-15 11:04 ` [PATCH v2 2/3] xen/sched: carve out memory allocation and freeing from schedule_cpu_rm() Juergen Gross
2022-08-15 11:52   ` Jan Beulich
2022-08-15 11:55     ` Juergen Gross
2022-08-15 12:00       ` Jan Beulich
2022-08-15 12:16         ` Juergen Gross
2022-08-15 12:34           ` Jan Beulich
2022-08-15 12:47             ` Juergen Gross
2022-08-15 14:28               ` Juergen Gross
2022-08-15 11:04 ` [PATCH v2 3/3] xen/sched: fix cpu hotplug Juergen Gross
2022-08-15 12:27   ` Jan Beulich

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=1e86164f-b08c-a9bd-3437-af569342cc1e@suse.com \
    --to=jgross@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dfaggioli@suse.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.