linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, anton@samba.org, nish.aravamudan@gmail.com
Subject: Re: [PATCH] powerpc/numa: Fix percpu allocations to be NUMA aware
Date: Fri, 2 Jun 2017 22:50:16 +1000	[thread overview]
Message-ID: <20170602225016.06415f8f@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <87y3ta1zqf.fsf@concordia.ellerman.id.au>

On Fri, 02 Jun 2017 19:54:32 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:

> >> @@ -672,10 +672,19 @@ static void __init pcpu_fc_free(void *ptr, size_t size)
> >>  
> >>  static int pcpu_cpu_distance(unsigned int from, unsigned int to)
> >>  {
> >> -	if (cpu_to_node(from) == cpu_to_node(to))
> >> -		return LOCAL_DISTANCE;
> >> -	else
> >> -		return REMOTE_DISTANCE;
> >> +#ifndef CONFIG_NUMA
> >> +	return LOCAL_DISTANCE;
> >> +#else
> >> +	int from_nid, to_nid;
> >> +
> >> +	from_nid = early_cpu_to_node(from);
> >> +	to_nid   = early_cpu_to_node(to);
> >> +
> >> +	if (from_nid == -1 || to_nid == -1)
> >> +		return LOCAL_DISTANCE;	/* Or assume remote? */
> >> +
> >> +	return node_distance(from_nid, to_nid);  
> >
> > If you made node_distance() return LOCAL_NODE for !NUMA, this
> > should fall out and not require the ifdef?  
> 
> Maybe yeah. This is designed to be minimal for backporting though.

Okay fair enough. Is it expected to get back -1 from this ever? I think
all we need is local vs not local to direct whether to pack CPUs into
the same chunks or not so I wonder if the equality test is simpler.

Probably not a big deal though. Patch looks good as is.

Thanks,
Nick

  reply	other threads:[~2017-06-02 12:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02  5:14 [PATCH] powerpc/numa: Fix percpu allocations to be NUMA aware Michael Ellerman
2017-06-02  5:30 ` Nicholas Piggin
2017-06-02  9:54   ` Michael Ellerman
2017-06-02 12:50     ` Nicholas Piggin [this message]
2017-06-06 10:05       ` Michael Ellerman
2017-06-06 11:42 ` Balbir Singh
2017-06-07 11:28   ` Michael Ellerman

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=20170602225016.06415f8f@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=nish.aravamudan@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).