From: Nathan Lynch <nathanl@linux.ibm.com>
To: Scott Cheloha <cheloha@linux.ibm.com>
Cc: Nathan Fontenont <ndfont@gmail.com>,
Michal Hocko <mhocko@suse.com>,
Michal Suchanek <msuchanek@suse.com>,
David Hildenbrand <david@redhat.com>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Rick Lindsley <ricklind@linux.vnet.ibm.com>
Subject: Re: [PATCH v2 2/2] pseries/hotplug-memory: leverage xarray API to simplify code
Date: Fri, 21 Feb 2020 14:03:02 -0600 [thread overview]
Message-ID: <87pne7so7d.fsf@linux.ibm.com> (raw)
In-Reply-To: <20200221172901.1596249-3-cheloha@linux.ibm.com>
Hi Scott,
Scott Cheloha <cheloha@linux.ibm.com> writes:
> -#define for_each_drmem_lmb_in_range(lmb, start, end) \
> - for ((lmb) = (start); (lmb) <= (end); (lmb)++)
> -
> -#define for_each_drmem_lmb(lmb) \
> - for_each_drmem_lmb_in_range((lmb), \
> - &drmem_info->lmbs[0], \
> - &drmem_info->lmbs[drmem_info->n_lmbs - 1])
A couple things.
This will conflict with "powerpc/pseries: Avoid NULL pointer dereference
when drmem is unavailable" which is in linuxppc/next-test:
https://patchwork.ozlabs.org/patch/1231904/
Regardless, I don't think trading the iterator macros for open-coded
loops improve the code:
> - for_each_drmem_lmb(lmb) {
> + for (i = 0; i < drmem_info->n_lmbs; i++) {
> + lmb = &drmem_info->lmbs[i];
[...]
> +struct xarray;
> +extern struct xarray *drmem_lmb_xa;
drmem_lmb_xa should go in the drmem_info structure if you can't make it
static in drmem.c.
>
> /*
> * The of_drconf_cell_v1 struct defines the layout of the LMB data
> @@ -71,23 +66,6 @@ static inline u32 drmem_lmb_size(void)
> return drmem_info->lmb_size;
> }
>
> -#define DRMEM_LMB_RESERVED 0x80000000
> -
> -static inline void drmem_mark_lmb_reserved(struct drmem_lmb *lmb)
p> -{
> - lmb->flags |= DRMEM_LMB_RESERVED;
> -}
> -
> -static inline void drmem_remove_lmb_reservation(struct drmem_lmb *lmb)
> -{
> - lmb->flags &= ~DRMEM_LMB_RESERVED;
> -}
> -
> -static inline bool drmem_lmb_reserved(struct drmem_lmb *lmb)
> -{
> - return lmb->flags & DRMEM_LMB_RESERVED;
> -}
The flag management is logically separate from the iterator changes, so
splitting that out would ease review.
Looking further... yes, this needs to be a series of smaller changes
please.
next prev parent reply other threads:[~2020-02-21 20:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 22:11 [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup Scott Cheloha
2020-01-28 23:56 ` Nathan Lynch
2020-01-29 18:10 ` Scott Cheloha
2020-01-30 16:09 ` Fontenot, Nathan
2020-02-03 20:13 ` Scott Cheloha
2020-02-05 14:33 ` Fontenot, Nathan
2020-02-04 16:19 ` Scott Cheloha
2020-02-21 17:29 ` pseries: accelerate drmem and simplify hotplug with xarrays Scott Cheloha
2020-02-21 17:29 ` [PATCH v2 1/2] powerpc/drmem: accelerate memory_add_physaddr_to_nid() with LMB xarray Scott Cheloha
2020-02-21 20:02 ` Nathan Lynch
2020-07-22 23:00 ` Anton Blanchard
2020-02-21 17:29 ` [PATCH v2 2/2] pseries/hotplug-memory: leverage xarray API to simplify code Scott Cheloha
2020-02-21 20:03 ` Nathan Lynch [this message]
2020-02-21 18:11 ` [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup Nathan Lynch
2020-02-21 18:28 ` Nathan Lynch
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=87pne7so7d.fsf@linux.ibm.com \
--to=nathanl@linux.ibm.com \
--cc=cheloha@linux.ibm.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhocko@suse.com \
--cc=msuchanek@suse.com \
--cc=ndfont@gmail.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).