Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3664931pxu; Sun, 11 Oct 2020 19:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzcySqnNUHYuLAAxNa4926HuHSAtMPfbJf8uWZJN+L845oswYmKQT6QhdjOvSyF/3Tw5mS X-Received: by 2002:a17:906:6158:: with SMTP id p24mr25396814ejl.35.1602469419459; Sun, 11 Oct 2020 19:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602469419; cv=none; d=google.com; s=arc-20160816; b=Nb/2+sfiCGJa7dBw65x3K07zTFA4XsOTGhCduIeJ1Npn3/v0iMxUcLm681xK3QJFHU 2YQJKpuLQfsZGix6LjUk9xR9b76M9p0DSputXuCPBl5v71+nFHKyyaj7rOxfNSkBn1nb V7/3IDmQgjQ3SOliYLMDi0YJxGrNz4JllJypYQlmekhuCjiOWWkAUJPCslQfy7puZqgt KgtV565xxKebbYJ7PoDGkFLmG0L07rStZFKKS+5Jh8589+3MSLeA0cxvBzpN8lUQHO5j 6QhZcXtBmukT5dIvOYWRPCL+BQ2GHS5nv9+hlvU+DotpvFtLgzdTdkrX07mYHza2VjF7 rHqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=yo56AIVyhEYPxSv2JlEJyJpb6J14aVndNPRknfXEuVs=; b=eGhWau6T3yQm+XLBvrRhPu/wTzsurljRQqgQcJDM1cWTRU93th9srLF9PdRoJNBpcp lw5tvOA/oB2I69AyyUoanryGnZ+AMozh/L7SIogTXY+x1YIN65Q3PCQNh74t7QUt7Ib/ b1ybNmuL6HtzJDjWgPJSuyboVq6FzWKE+u9YrSEjHxAOqyy4Znt/L/TQj3FalzoivdZ3 0mBLJeKb5BfyfAromTTw7p8TR4D3MUnstGYQRnvLb7sI+XW++eVTekRiVjt+dy8Enxia ez6pBbbS0rB2dDflFhXhTXdjz+sXDAKltR1kHufPjrfkn2qg0UyOJO3QR2gIXc+zqbD2 +2rQ== 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 n2si13672528edi.70.2020.10.11.19.23.17; Sun, 11 Oct 2020 19:23:39 -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 S1726625AbgJLAO6 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 11 Oct 2020 20:14:58 -0400 Received: from smtp.h3c.com ([60.191.123.50]:62718 "EHLO h3cspam02-ex.h3c.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbgJLAO5 (ORCPT ); Sun, 11 Oct 2020 20:14:57 -0400 Received: from DAG2EX02-BASE.srv.huawei-3com.com ([10.8.0.65]) by h3cspam02-ex.h3c.com with ESMTPS id 09C0EcWI014370 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Oct 2020 08:14:38 +0800 (GMT-8) (envelope-from tian.xianting@h3c.com) Received: from DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) by DAG2EX02-BASE.srv.huawei-3com.com (10.8.0.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 12 Oct 2020 08:14:39 +0800 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074]) by DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074%7]) with mapi id 15.01.1713.004; Mon, 12 Oct 2020 08:14:39 +0800 From: Tianxianting To: Jakub Kicinski CC: "davem@davemloft.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] net: Avoid allocing memory on memoryless numa node Thread-Topic: [PATCH] net: Avoid allocing memory on memoryless numa node Thread-Index: AQHWn4X33nOETvWn/EOdjwgvT00GhKmSQVKAgADYw6A= Date: Mon, 12 Oct 2020 00:14:39 +0000 Message-ID: References: <20201011041140.8945-1-tian.xianting@h3c.com> <20201011121803.2c003c7e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20201011121803.2c003c7e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.99.141.128] x-sender-location: DAG2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-DNSRBL: X-MAIL: h3cspam02-ex.h3c.com 09C0EcWI014370 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jakub, Thanks for your suggestion, Let me try it :-) -----Original Message----- From: Jakub Kicinski [mailto:kuba@kernel.org] Sent: Monday, October 12, 2020 3:18 AM To: tianxianting (RD) Cc: davem@davemloft.net; netdev@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: Avoid allocing memory on memoryless numa node On Sun, 11 Oct 2020 12:11:40 +0800 Xianting Tian wrote: > 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 > --- > net/core/dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/core/dev.c b/net/core/dev.c index > 266073e30..dcb4533ef 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -2590,7 +2590,7 @@ static struct xps_map *expand_xps_map(struct xps_map *map, int attr_index, > new_map = kzalloc(XPS_MAP_SIZE(alloc_len), GFP_KERNEL); > else > new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL, > - cpu_to_node(attr_index)); > + local_memory_node(cpu_to_node(attr_index))); > if (!new_map) > return NULL; > Are we going to patch all kmalloc_node() callers now to apply local_memory_node()? Can't the allocator take care of this?