Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2648897pxu; Sat, 10 Oct 2020 02:47:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVk13I8JKAFx/SL0nu/i6NQD3uW9LhD/uQCFMRY617Yrciwf6/3QoLlZSy/EzqZ1oOKqKF X-Received: by 2002:a17:906:4c93:: with SMTP id q19mr17641360eju.198.1602323276628; Sat, 10 Oct 2020 02:47:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602323276; cv=none; d=google.com; s=arc-20160816; b=rgHa9M+m2kN4vhyI746fHRojz2EEHRLyvo5Jc6KRpUVE6s+mC47PcB92FyJlPDMPCW cowDQQkM4w0XUS3rVHiA+TKQbd1zqQqNAY35v5fbfoUpKzeVisHhAj5OYcydyggL5Lb3 mjzC7cLoYp6M5rlha6/VZaUzfKVosKZr/7z3l9ahDe0qRbG9XRT9/Olee3NUWbviVPxz bMMeGiIlkeBwCt2ZJi/ZJHbukPVOkz8YiiUipjSI9ptpjCUC/Li/vLHl/aYv1qG6jJUT puH9xU2uMb0Q3ffiPiACZceou5yHpGvMev/aClUIDwV7R+P8Op99bZUR8tZkz+MbtK4H K1sA== 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=0wFpzLMC9vIvsKJnPUcNWn+0l27Re7MOvfNPOToBdXk=; b=XcSHlbEJ8o+jN5uQ7J9KUU5b+xjKGX+SXwcTjpeefRG0XWomnYix3UAyhKxTg9jAhn 53RFCsDPG/tjI1StRkWzBY3ob0OR1a9OE10w0ks7pQ1IJFCB2uEakXWoUqDUgT4R0Fat r/GEKK/z2NnlBQoYXvzBF1qcELYGlyZH9gDl/6a0g5rdISztsnQ91b2tUWrsM5E/vdtz /D04Dzw5quhUJPUvoLKWkXD+pblAnw6iXEA2cLXaptkkAeQXgJgWqgTS2sCwceNIQWkr IWa39hGgYf2KDy4+p7kMR4tI5Mhv4FAWmfctpIPI6hQg1FVOqd3S3gKmXxmsSCnnQIdj ZYvw== 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 l13si8021773ejz.710.2020.10.10.02.47.32; Sat, 10 Oct 2020 02:47:56 -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 S1728924AbgJJJA0 (ORCPT + 99 others); Sat, 10 Oct 2020 05:00:26 -0400 Received: from smtp.h3c.com ([60.191.123.50]:50845 "EHLO h3cspam02-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbgJJI4z (ORCPT ); Sat, 10 Oct 2020 04:56:55 -0400 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([10.8.0.66]) by h3cspam02-ex.h3c.com with ESMTPS id 09A8s6nc045991 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 10 Oct 2020 16:54:06 +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 16:54:09 +0800 From: Xianting Tian To: , , , , , , , , , , CC: , , , Xianting Tian Subject: [PATCH] bpf: Avoid allocing memory on memoryless numa node Date: Sat, 10 Oct 2020 16:44:17 +0800 Message-ID: <20201010084417.5400-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: BJSMTP02-EX.srv.huawei-3com.com (10.63.20.133) To DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) X-DNSRBL: X-MAIL: h3cspam02-ex.h3c.com 09A8s6nc045991 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 --- kernel/bpf/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index 6386b7bb9..2c885c00a 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -423,7 +423,7 @@ __cpu_map_entry_alloc(struct bpf_cpumap_val *value, u32 cpu, int map_id) struct xdp_bulk_queue *bq; /* Have map->numa_node, but choose node of redirect target CPU */ - numa = cpu_to_node(cpu); + numa = local_memory_node(cpu_to_node(cpu)); rcpu = kzalloc_node(sizeof(*rcpu), gfp, numa); if (!rcpu) -- 2.17.1