[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 09/10] xen/nodemask: Sanitise the remainder of the nodemask API


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Tue, 30 Jul 2019 11:43:12 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hhLskxUrnsSdqY76xa9zsWOnNJriGaLXvafh/kZeJqs=; b=QAeqGtV9FAdOMoptSeXq2iA23cKLFxi/sFL8xYcm/ELjkksIkq/LOwpP8Km/HQEqJgeE/cgqstbr24Mq+LC9pjyhc4RsZ2NwDIEpe+/VuqJgc9lzqqwSXROGs5lCoylQJzsPqzdfsnllS+Mt0Hz09mxw37400ceWjXz4kw36c06Sl7v4PfVg/dWPrROv9LEabsQCUC91SOk2qqw1W9VzA+bTLC1QJW/+NP64qGOJakXi2fjvS2E3g6X2AMxP+XNfxFR0+bJqYD4w2nP8S2o1EKkHbmKf5nK7iOFLzXIOJXfQkErBZSOkzvaasf1X1zhw+YBdc/ss5CBy4wmF9+mqpg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7/+4BjrVYbUREIzFeDIKVNIzYcH/WSsi80mxsQ80K98q88Oq4INSv2dyrGAEmakj/xtqYdPHqTTMW8SB7SScvEyUprnusLwfzSdr3sINyNjgdpZ/exg2eyoJIiAfFeqAyKPhSDlkcPJqd8EYYoHZbZQ5iiZ/tUolGuY+vG8CgbBZfK8xoQxAqzCKvsHaC+jmsgzAHnHczZmphmpYeOjLtd1hQz3g+EOJfnDa61YYGftQvgW5nRwcHAjGOB5fisyAHm4i0jeyolnhaJAFC4MLAh5YJ1SgphWzw0f9sL09pwjMYj2pNkvhgfM66wYRc5TgZzzhTHIqcrRUb2dI6/4og==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: StefanoStabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 30 Jul 2019 11:46:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVRgbsWQPLgo+6rE+uTMPGcGF31qbjC9qA
  • Thread-topic: [PATCH v3 09/10] xen/nodemask: Sanitise the remainder of the nodemask API

On 29.07.2019 14:12, Andrew Cooper wrote:
> --- a/xen/arch/x86/srat.c
> +++ b/xen/arch/x86/srat.c
> @@ -332,7 +332,7 @@ acpi_numa_memory_affinity_init(const struct 
> acpi_srat_mem_affinity *ma)
>       if (!(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)) {
>               struct node *nd = &nodes[node];
>   
> -             if (!node_test_and_set(node, memory_nodes_parsed)) {
> +             if (!nodemask_test_and_set(node, &memory_nodes_parsed)) {

Shouldn't this have become __nodemask_test_and_set() already in the
previous patch (with the leading underscores taken care of in
whatever way we decide there)?

> @@ -376,7 +376,7 @@ static int __init nodes_cover_memory(void)
>   
>               do {
>                       found = 0;
> -                     for_each_node_mask(j, memory_nodes_parsed)
> +                     for_each_node_mask( j, &memory_nodes_parsed )

Here and elsewhere - if you add the inner blanks, then there also
wants to be a blank ahead of the opening parenthesis.

> @@ -1171,7 +1171,7 @@ static unsigned int node_to_scrub(bool get_node)
>           node = 0;
>   
>       if ( node_need_scrub[node] &&
> -         (!get_node || !node_test_and_set(node, node_scrubbing)) )
> +         (!get_node || !nodemask_test_and_set(node, &node_scrubbing)) )
>           return node;
>   
>       /*
> @@ -1205,10 +1205,10 @@ static unsigned int node_to_scrub(bool get_node)
>                * then we'd need to take this lock every time we come in here.
>                */
>               if ( (dist < shortest || closest == NUMA_NO_NODE) &&
> -                 !node_test_and_set(node, node_scrubbing) )
> +                 !nodemask_test_and_set(node, &node_scrubbing) )
>               {
>                   if ( closest != NUMA_NO_NODE )
> -                    node_clear(closest, node_scrubbing);
> +                    nodemask_clear(closest, &node_scrubbing);
>                   shortest = dist;
>                   closest = node;
>               }
> @@ -1360,7 +1360,7 @@ bool scrub_free_pages(void)
>       spin_unlock(&heap_lock);
>   
>    out_nolock:
> -    node_clear(node, node_scrubbing);
> +    nodemask_clear(node, &node_scrubbing);

Seeing this happen after dropping the heap lock, I think the two
nodemask_test_and_set() that I've left in context above could be
converted to their non-locked counterparts at this occasion (or
again in the previous patch).

>   #if MAX_NUMNODES > 1
>   #define for_each_node_mask(node, mask)                      \
> -     for ((node) = first_node(mask);                 \
> +     for ((node) = nodemask_first(mask);             \
>               (node) < MAX_NUMNODES;                  \
> -             (node) = next_node((node), (mask)))
> +             (node) = nodemask_next(node, mask))
>   #else /* MAX_NUMNODES == 1 */
>   #define for_each_node_mask(node, mask)                      \
> -     if (!nodes_empty(mask))                         \
> +     if ( !nodemask_empty(mask) )                    \
>               for ((node) = 0; (node) < 1; (node)++)
>   #endif /* MAX_NUMNODES */

Further up in the file you did also replace tabs and insert spaces.
Would you mind doing this here as well (I notice you've adjusted
the if() already, but left the for()s alone).

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.