All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: ian.campbell@citrix.com, andrew.cooper3@citrix.com,
	xen-devel@lists.xen.org, JBeulich@suse.com
Subject: Re: [RFC PATCH 1/2] xen: page_alloc: introduce alloc_domheap_pages_nodemask()
Date: Wed, 19 Mar 2014 19:54:41 +0100	[thread overview]
Message-ID: <1395255281.13892.58.camel@Solace> (raw)
In-Reply-To: <1395145511-13381-1-git-send-email-bob.liu@oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 3120 bytes --]

On mar, 2014-03-18 at 20:25 +0800, Bob Liu wrote:
> Introduce alloc_domheap_pages_nodemask() to allow specification of which node(s)
> to allocate memory from even when 'd == NULL' is true.
> 
To me, this sentence would sound better, and more accurate wrt the
implementation below, without the 'even'.

Code wise...

> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
>  xen/common/page_alloc.c |   25 +++++++++++++++++--------
>  xen/include/xen/mm.h    |    4 ++++
>  2 files changed, 21 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
> index 601319c..85e8188 100644
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -561,16 +561,18 @@ static void check_low_mem_virq(void)
>  static struct page_info *alloc_heap_pages(
>      unsigned int zone_lo, unsigned int zone_hi,
>      unsigned int order, unsigned int memflags,
> -    struct domain *d)
> +    struct domain *d, nodemask_t nodemask)
>  {
>      unsigned int first_node, i, j, zone = 0, nodemask_retry = 0;
>      unsigned int node = (uint8_t)((memflags >> _MEMF_node) - 1);
>      unsigned long request = 1UL << order;
>      struct page_info *pg;
> -    nodemask_t nodemask = (d != NULL ) ? d->node_affinity : node_online_map;
>      bool_t need_tlbflush = 0;
>      uint32_t tlbflush_timestamp = 0;
>  
> +    if (d != NULL)
> +        nodemask = d->node_affinity;
> +
>      if ( node == NUMA_NO_NODE )
>      {
>          memflags &= ~MEMF_exact_node;
>
... If it were me, I probably would have added
alloc_heap_pages_nodemask(...,nodemask_t nodemask) (similarly to what we
do up here, plus the actual renaming to alloc_heap_pages_nodemask() )
and have the 'new' alloc_heap_pages() be a wrapper of that, with

    (d != NULL ) ? d->node_affinity : node_online_map

as the nodemask parameter. The reason is it looks cleaner and easier to
use to me. In particular, what I dislike is this...

> @@ -1338,7 +1340,7 @@ void *alloc_xenheap_pages(unsigned int order, unsigned int memflags)
>      ASSERT(!in_irq());
>  
>      pg = alloc_heap_pages(MEMZONE_XEN, MEMZONE_XEN,
> -                          order, memflags, NULL);
> +                          order, memflags, NULL, node_online_map);
>
... the alloc_heap_pages(...,NULL,node_online_map) call, but that's
mostly a matter of taste, I guess, so if maintainers are fine with the
current approach, I certainly am too.

The only thing I'm a bit concerned about is the fact that, either way,
if one specifies a non NULL domain, the domain's node_affinity is used,
and the nodemask ignored. I'm fine with it, but shouldn't this be a bit
more evident (a comment, some if()/ASSERT, the changelog, etc.)?

BTW, apart from these minor observation, and FWIW, this change looks
fine to me.

Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

      parent reply	other threads:[~2014-03-19 18:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18 12:25 [RFC PATCH 1/2] xen: page_alloc: introduce alloc_domheap_pages_nodemask() Bob Liu
2014-03-18 12:25 ` [RFC PATCH 2/2] xen: tmem: make tmem aware of NUMA affinity Bob Liu
2014-03-18 14:29   ` Jan Beulich
2014-03-19 17:12     ` Konrad Rzeszutek Wilk
2014-03-20  9:26       ` Jan Beulich
2014-03-20 11:59         ` Bob Liu
2014-03-20 12:30           ` Jan Beulich
2014-03-19 18:54 ` Dario Faggioli [this message]

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=1395255281.13892.58.camel@Solace \
    --to=dario.faggioli@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=lliubbo@gmail.com \
    --cc=xen-devel@lists.xen.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.