Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2264372ybv; Fri, 21 Feb 2020 12:03:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwkkvdgabX6vIR/8XrvlQtmxzWB2/QX9efp1ejeL6Hee2S4C57ZGLprXBOnDDTB5YD6gp36 X-Received: by 2002:a9d:4b05:: with SMTP id q5mr28301289otf.57.1582315420537; Fri, 21 Feb 2020 12:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582315420; cv=none; d=google.com; s=arc-20160816; b=GiNwtL1T+9dm08ysLLKlcgzWEdwhBuBt2W7pifKlV1Hvfvnrl+KUFz+Lk/U5KxpF1o 96TNA0ZzQjf4Jp0wHhmqPSDcqRF+yi3DDnZMptxczXmHvOwIMOHYjQIUSHqxRo49YThV 2T/jHj/NmTMcZBUj323yiCRPeQmLe+WkLa6KGt0gS2DsaptkDwGKio85zVms6siyj6LW JZMZmd7BJ08jS+dZlfjUU5niPFYINZovvzNwaQvhfxOkLM0uFBirEjPNDepHL7w4YcVj SfA1bzZO6jgA6X7kut5Mv79F56v/WsabI0PGtElYYydQmXqJLk+Hv0DDw/c/OJbscm2N pQ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=DW3t34/6De0oAh8jIeF4JJMXEuOJnSr7pldQwOKZxAM=; b=Jpq18/EAwSe+69N+B6Sj4h+iYKKF+vZrYfxJyZTh21l5n5uREB+JcBnVUpBO3tWhlw 13EQt/9mDS6Jl87WEZ8mtfHeQkmfNyBjPplAKnYNPYRLMrzvZYZyZ80ksAgqM5XSxpX2 jVkceOX95qOukz1dNIEz7z6683eT3PVu3zmsMxJpkJXf4+vUax/pILkE0hd6qdgBLOC9 xO7U0ut9z02q6Ajr+xLggMNAOCkyLk4DJkvlwoMEapPhLKosy2oViEo/QV3UI1QHa1PM EyYZne3Rm+iZRBn6PjObeBRVWgNbJks21LVlGKjFEGnUXnB7w2bnv52Rlh8RK270rh+H wc/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si1916198ote.9.2020.02.21.12.03.28; Fri, 21 Feb 2020 12:03:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727352AbgBUUDS (ORCPT + 99 others); Fri, 21 Feb 2020 15:03:18 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:5896 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726443AbgBUUDS (ORCPT ); Fri, 21 Feb 2020 15:03:18 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01LJq6M1023464; Fri, 21 Feb 2020 15:03:05 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y9tkdcrxu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 15:03:05 -0500 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01LJqp4L024213; Fri, 21 Feb 2020 15:03:05 -0500 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y9tkdcrxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 15:03:05 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01LK146K024904; Fri, 21 Feb 2020 20:03:04 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma02dal.us.ibm.com with ESMTP id 2y6897nekp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 20:03:04 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01LK33ha44499376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Feb 2020 20:03:03 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 022AB136053; Fri, 21 Feb 2020 20:03:03 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC4E7136051; Fri, 21 Feb 2020 20:03:02 +0000 (GMT) Received: from localhost (unknown [9.41.179.160]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 21 Feb 2020 20:03:02 +0000 (GMT) From: Nathan Lynch To: Scott Cheloha Cc: Rick Lindsley , David Hildenbrand , Michal Suchanek , Michal Hocko , Nathan Fontenont , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman Subject: Re: [PATCH v2 2/2] pseries/hotplug-memory: leverage xarray API to simplify code In-Reply-To: <20200221172901.1596249-3-cheloha@linux.ibm.com> References: <20200128221113.17158-1-cheloha@linux.ibm.com> <20200221172901.1596249-3-cheloha@linux.ibm.com> Date: Fri, 21 Feb 2020 14:03:02 -0600 Message-ID: <87pne7so7d.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-21_07:2020-02-21,2020-02-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 mlxscore=0 mlxlogscore=747 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002210151 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Scott, Scott Cheloha 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.