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

Re: [Xen-devel] [PATCH v3 07/10] xen/nodemask: Drop nodes_{setall, clear}() and improve the initialisers


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <JBeulich@xxxxxxxx>
  • Date: Tue, 30 Jul 2019 09:44:18 +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=MRIHTvYDzR+Gc21NdtDUHm977Yif5xPTPKMU5kTN0qM=; b=DrAQZThQX7ItSBLinrrIE828xJBwVH5dnMhme+NydsD/SOzRG9rx22Y32oLt4Et9EenpnGDik62eH6Lok70CQKHXzzzHaH1RPVnfd/NIJhbJCVjacKtXpilyx7oQW5AbcHgDBltzZCP/Hy9IEynsdzMbPDf1+G4elPsk6jLWornNKQ1+B1B8XH8Mfm1yv4eQhmxguzPLQTmdIMCzv0+25EOHyLOJ+6B5qRmWDhWuHwvbmdAZhyy45gL9VX0he+SAUQNNEx7YzWclLa8+R0ohe5WNhEkGxJPEw0FDLLwOUFTxunNni6smoCSzj6nPC7ZEPyEczu6/SQey7OjZNggLaQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E/l+F23H/vzpCvpM8qdDFG5gMzpjRsSHhGz/2IDg9egJvwk+V1dacSuD8k179137vkgbUaGclQbcWBleMF5+GqQaOcHdll3uncQIJvj77tSvcCZNLBrXqNuSkSZRqPKj2NBb1RsJgkAQEST8n9X5tq+7FdQtGX4u3YKoG9ceQKHwwaKZH6HOKKXWKhVpPdFwCnMWzMuJIceRhpiFmVn3KzAkL/8wf5TqA/H1BHgB14HCdpUBLXm+N2Hn3uQOL4I/m88GAPxyqRciFcMx+4GKe0Atch721R7JbunRHCu4zClfCiw/I21zJu5wR2FHGhjRVrOX5uIhAxxVrpb6x8wdiQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
  • Cc: StefanoStabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 30 Jul 2019 09:58:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVRgbx+NC5iMPPZEewtwNnf41+y6bi6p2A
  • Thread-topic: [PATCH v3 07/10] xen/nodemask: Drop nodes_{setall,clear}() and improve the initialisers

On 29.07.2019 14:12, Andrew Cooper wrote:
> There is no need to use runtime variable-length clearing when MAX_NUMNODES is
> known to the compiler.  Drop these functions and use the initialisers instead.

The only slight concern I have with this is that it further locks
down the maximum remaining to be a compile time constant. But this
is not an objection, just a remark.

> @@ -67,7 +65,34 @@ typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } 
> nodemask_t;
>   
>   #define nodemask_bits(src) ((src)->bits)
>   
> -extern nodemask_t _unused_nodemask_arg_;
> +#define NODEMASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES)
> +
> +#define NODEMASK_NONE                                                   \
> +((nodemask_t) {{                                                        \
> +        [0 ... BITS_TO_LONGS(MAX_NUMNODES) - 1] = 0                     \
> +}})
> +
> +#if MAX_NUMNODES <= BITS_PER_LONG
> +
> +#define NODEMASK_ALL      ((nodemask_t) {{ NODEMASK_LAST_WORD }})
> +#define NODEMASK_OF(node) ((nodemask_t) {{ 1UL << (node) }})
> +
> +#else /* MAX_NUMNODES > BITS_PER_LONG */
> +
> +#define NODEMASK_ALL                                                    \
> +((nodemask_t) {{                                                        \
> +        [0 ... BITS_TO_LONGS(MAX_NUMNODES) - 2] = ~0UL,                 \
> +        [BITS_TO_LONGS(MAX_NUMNODES) - 1] = NODEMASK_LAST_WORD          \
> +}})
> +
> +#define NODEMASK_OF(node)                                               \
> +({                                                                      \
> +    nodemask_t m = NODES_NONE;                                          \
> +    m.bits[(node) / BITS_PER_LONG] = 1UL << ((node) % BITS_PER_LONG);   \

I think you will want to avoid the double evaluation of "node"
here. With this taken care of
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

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®.