linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Cheloha <cheloha@linux.ibm.com>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	linuxppc-dev@ozlabs.org, Michal Suchanek <msuchanek@suse.de>,
	Rick Lindsley <ricklind@linux.vnet.ibm.com>
Subject: Re: [PATCH v3] pseries/drmem: don't cache node id in drmem_lmb struct
Date: Thu, 10 Sep 2020 13:28:12 -0500	[thread overview]
Message-ID: <20200910182812.bsjjh4x45hwannor@rascal.austin.ibm.com> (raw)
In-Reply-To: <2704bebf-8c7b-7912-5e03-ddcc57acf8d1@linux.vnet.ibm.com>

On Fri, Aug 21, 2020 at 10:33:10AM +0200, Laurent Dufour wrote:
> Le 11/08/2020 à 03:51, Scott Cheloha a écrit :
> > 
> > [...]
> > 
> > @@ -631,7 +638,7 @@ static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index)
> >   static int dlpar_add_lmb(struct drmem_lmb *lmb)
> >   {
> >   	unsigned long block_sz;
> > -	int rc;
> > +	int nid, rc;
> > 
> >   	if (lmb->flags & DRCONF_MEM_ASSIGNED)
> >   		return -EINVAL;
> > @@ -642,11 +649,13 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
> >   		return rc;
> >   	}
> > 
> > -	lmb_set_nid(lmb);
> >   	block_sz = memory_block_size_bytes();
> > 
> > +	/* Find the node id for this address. */
> > +	nid = memory_add_physaddr_to_nid(lmb->base_addr);
> 
> I think we could be more efficient here.
> Here is the call stack behind memory_add_physaddr_to_nid():
> 
>   memory_add_physaddr_to_nid(lmb->base_addr)
>     hot_add_scn_to_nid()
>       if (of_find_node_by_path("/ibm,dynamic-reconfiguration-memory")) == true*
>       then
> 	  hot_add_drconf_scn_to_nid()
> 	    for_each_drmem_lmb() to find the LMB based on lmb->base_addr
> 	      of_drconf_to_nid_single(found LMB)
> 		use lmb->aa_index to get the nid.
> 
> * that test is necessarily true when called from dlpar_add_lmb()
> otherwise the call to update_lmb_associativity_index() would have
> failed earlier.
> 
> Basically, we have a LMB and we later walk all the LMBs to find that lmb
> again.  In the case of dlpar_add_lmb(), it would be more efficient to
> directly call of_drconf_to_nid_single(). That function is not exported
> from arch/powerpc/mm/numa.c but it may be good to export it through that
> patch.

I've posted a patch for this:

https://lore.kernel.org/linuxppc-dev/20200910175637.2865160-1-cheloha@linux.ibm.com/T/#u

The speedup is nice, especially for LMBs at the end of the array.

  reply	other threads:[~2020-09-10 18:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  1:51 [PATCH v3] pseries/drmem: don't cache node id in drmem_lmb struct Scott Cheloha
2020-08-14 17:27 ` Nathan Lynch
2020-08-14 19:31   ` Nathan Lynch
2020-08-21  8:33 ` Laurent Dufour
2020-09-10 18:28   ` Scott Cheloha [this message]
2020-09-09 13:27 ` 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=20200910182812.bsjjh4x45hwannor@rascal.austin.ibm.com \
    --to=cheloha@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=msuchanek@suse.de \
    --cc=nathanl@linux.ibm.com \
    --cc=ricklind@linux.vnet.ibm.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).