Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2134851ybv; Fri, 21 Feb 2020 09:31:22 -0800 (PST) X-Google-Smtp-Source: APXvYqy7aacaYu9LLj67HfwOXb0NkHh94gQAEdTNkR0PyZ7YYxP4BB0LWEh/Pc7/rwX3QUcBYmKE X-Received: by 2002:a9d:7508:: with SMTP id r8mr28899716otk.116.1582306282093; Fri, 21 Feb 2020 09:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582306282; cv=none; d=google.com; s=arc-20160816; b=qxem0eHlEa+2XSdINjNYACtCMnRCstjE+gly4+MS51qD+aU+2Zr7VNs6sfbAd9BZrU qAcAZ2Uz3E7UlvlxoQUZkQAQcgMVmcQrqcRIWz2degykL2TvVuQT7ZARoZHokreBYEK2 s4zYmYknWL1r0FUVHY1oey8DJD4BI1M69qrKv2AwLi8ER2UwC6pDGTpMCabVWMfuZ97S TCFKZfrUVcB+QrhTvfJGnvD80ToHRh5STUbV3S3hNVcc0enuIejAJmaYp4xEHW+G0nwF +lCHusW6cxZG83Ondx9S5OK7/z3YJWZGYBx9a5JEt8jxF8I0UmbITKQrFWlKV9Ofr/RZ e2Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XkaLmKmibHMtfJVH0/DnCyVVEmUJtJ1K9gXW0OfAZj8=; b=Ap38FYa9bHHi6UK1uSidZpbiKvHhHdYHt9JaYJMDuI310JRt4eRnosqo+tpI5H0eGu pmRvgg7jBZY7apjsAtE9HsZ9fbhzLmUT6tt8eAxIxqTEYhQ7EkMn7S5OqNDhSbUlsVEw wMr/AJnUJb21TEjkZXNA5BLqJCPfl8QDlyDIGq/m9Ln4pBHPYPuEeiMzd+LjxSJ7a3hA Ah38fEv5+nTdGa7qCoy3VrjHEcC8QAbVjSpx152mz3hHFrj9vFaeVmAui820gR88vyYU i+9fpt5Qo/LdoxYogEYKxIWLLT0koav++8kgLCs7TU/T65MdCzRyeCtT6rutLZElMyKC kFTQ== 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 p19si1756244otk.251.2020.02.21.09.31.08; Fri, 21 Feb 2020 09:31:22 -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 S1728441AbgBURa5 (ORCPT + 99 others); Fri, 21 Feb 2020 12:30:57 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:27112 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727291AbgBURa4 (ORCPT ); Fri, 21 Feb 2020 12:30:56 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01LHPeem097193; Fri, 21 Feb 2020 12:30:45 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yadge6a65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 12:30:44 -0500 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01LHRpsX102535; Fri, 21 Feb 2020 12:30:44 -0500 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yadge6a5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 12:30:44 -0500 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01LHTnss005017; Fri, 21 Feb 2020 17:30:43 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma04dal.us.ibm.com with ESMTP id 2y6897meb3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 17:30:43 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01LHUg2n45679026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Feb 2020 17:30:42 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92DF6B2064; Fri, 21 Feb 2020 17:30:42 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEA3CB2068; Fri, 21 Feb 2020 17:30:41 +0000 (GMT) Received: from rascal.austin.ibm.com (unknown [9.41.179.32]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 21 Feb 2020 17:30:41 +0000 (GMT) From: Scott Cheloha To: linuxppc-dev@lists.ozlabs.org, Michael Ellerman Cc: Nathan Lynch , Rick Lindley , David Hildenbrand , Michal Suchanek , Michal Hocko , Nathan Fontenont , linux-kernel@vger.kernel.org Subject: pseries: accelerate drmem and simplify hotplug with xarrays Date: Fri, 21 Feb 2020 11:29:00 -0600 Message-Id: <20200221172901.1596249-1-cheloha@linux.ibm.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200128221113.17158-1-cheloha@linux.ibm.com> References: <20200128221113.17158-1-cheloha@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_06:2020-02-21,2020-02-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=715 clxscore=1011 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002210132 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series introduces two xarrays of LMBs in an effort to speed up the drmem code and simplify the hotplug code on pseries machines. The first patch introduces an xarray of LMBs indexed by physical address. xa_load() is then used to accelerate LMB lookup during memory_add_physaddr_to_nid(). The interface is used during boot, in drmem_init(), and memory hot-add, in dlpar_add_lmb(), on pseries machines. Its linear LMB search is a serious bottleneck on larger machines that xa_load() flattens nicely as shown in the before/after example. The second patch introduces a second xarray of LMBs, this one indexed by DRC index. The xarray API is leveraged to replace the custom LMB search/iteration/marking code currently used in the pseries memory hotplug module. The result is cleaner and, again thanks to xa_load(), faster. v1: One big patch. v2 changes: - Split up the big patch from v1 into a series. - Provide a more dramatic example in patch 1/2 to emphasize the linear search bottleneck in memory_add_physaddr_to_nid(). - Expand the use of the xarray API in patch 2/2 to replace more custom code.