Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2701893pxu; Sat, 10 Oct 2020 04:35:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAqC9QUXxWZ7OM3WBPW1kdVZHTQ92Ckvi0Narc/DJWE78aX4SwthvLj8rTsbhwGD949Rsw X-Received: by 2002:a17:906:1cca:: with SMTP id i10mr19397103ejh.487.1602329710131; Sat, 10 Oct 2020 04:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602329710; cv=none; d=google.com; s=arc-20160816; b=TMiXX+wXNN9M3aP3EQP3Yz0Ua4D2ZZum4UjF8Sn3+ri8QjGJE9RYHaDy6Eq411YAEL /tzK1j+vzuMEaT8recR+kT6LiaV/ZK7+M/WcYWGEUmkaXPbH17VyU5oJkeufY2e7utGF CQK4aNTuSrR9kWgp5bOT5nzPv6wWnEwBaBaR9sZH4tD/IFLCTDuOPQL7XadEQAyLxi6L 3CkL0COiabQpJkIewP7K8YqeY2G/twyIRLfxsESTp1wsTaUsMAQaO0Cjv+ocL3kjqlSG UJXhQrXZRYmCNiFcTKSox7Hh4pCWhWWpjJMApFiVKLHQRTiG7aDCiJb04+UpJMa9hFqT fUFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=vuGXymRCChAD+b92wa4ZrAlwYVO4oq4l2fobsqcNQ94=; b=ppDtVnFvSrudHw59CSf9kQuvn+mq+ncIQiwbUaDg+brXU341lxEeHWY59B2kqRRKlW dx0mwJC49Qm1ua+lsEmvpYMxUJ+HFmqeBXpCq0AoX+uOpAHV4BQNhRogN6fxYXFMu9bC qC2QvI2E+TOARVVDc/bmP0gZ1CXmQeZz3QNCrCnT2oHLR+S3CErEIwdfU1eIXv2PZfxM KR0hfB7eXZTVG3HHKc82o5lbMs4AMp4tDeGReMETlirnsrTNM4Fg9ruFxJmQvq3uAF4c pBRp6GUOHtTid4wsLRkixP6aDmdGY4CiqNfEBMhGHeFKqLunaI4K4NlFJVghAvcASWLP wBYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s26si10080831edr.397.2020.10.10.04.34.46; Sat, 10 Oct 2020 04:35:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729326AbgJJLWr (ORCPT + 99 others); Sat, 10 Oct 2020 07:22:47 -0400 Received: from smtp.h3c.com ([60.191.123.50]:52185 "EHLO h3cspam02-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbgJJKZ2 (ORCPT ); Sat, 10 Oct 2020 06:25:28 -0400 X-Greylist: delayed 4237 seconds by postgrey-1.27 at vger.kernel.org; Sat, 10 Oct 2020 06:24:59 EDT Received: from h3cspam02-ex.h3c.com (localhost [127.0.0.2] (may be forged)) by h3cspam02-ex.h3c.com with ESMTP id 09A99kEg079319; Sat, 10 Oct 2020 17:09:46 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from DAG2EX03-BASE.srv.huawei-3com.com ([10.8.0.66]) by h3cspam02-ex.h3c.com with ESMTPS id 09A97Cki074737 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 10 Oct 2020 17:07:13 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from localhost.localdomain (10.99.212.201) by DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sat, 10 Oct 2020 17:07:15 +0800 From: Xianting Tian To: , , , CC: , , Xianting Tian Subject: [PATCH] IB/hfi1: Avoid allocing memory on memoryless numa node Date: Sat, 10 Oct 2020 16:57:32 +0800 Message-ID: <20201010085732.20708-1-tian.xianting@h3c.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.99.212.201] X-ClientProxiedBy: BJSMTP01-EX.srv.huawei-3com.com (10.63.20.132) To DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) X-DNSRBL: X-MAIL: h3cspam02-ex.h3c.com 09A97Cki074737 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In architecture like powerpc, we can have cpus without any local memory attached to it. In such cases the node does not have real memory. Use local_memory_node(), which is guaranteed to have memory. local_memory_node is a noop in other architectures that does not support memoryless nodes. Signed-off-by: Xianting Tian --- drivers/infiniband/hw/hfi1/file_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index 8ca51e43c..79fa22cc7 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -965,7 +965,7 @@ static int allocate_ctxt(struct hfi1_filedata *fd, struct hfi1_devdata *dd, */ fd->rec_cpu_num = hfi1_get_proc_affinity(dd->node); if (fd->rec_cpu_num != -1) - numa = cpu_to_node(fd->rec_cpu_num); + numa = local_memory_node(cpu_to_node(fd->rec_cpu_num)); else numa = numa_node_id(); ret = hfi1_create_ctxtdata(dd->pport, numa, &uctxt); -- 2.17.1