Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3665387pxu; Sun, 11 Oct 2020 19:25:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwczacte3pOhcVu1o/Gwcz4ALB37Pa0PGGT0BslzgTkogw0SdaCS4MXXRe2NcPQth8g0KQS X-Received: by 2002:a17:906:e2d7:: with SMTP id gr23mr26371392ejb.360.1602469504197; Sun, 11 Oct 2020 19:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602469504; cv=none; d=google.com; s=arc-20160816; b=c/iYRJXRMX5/iVi90aBLgGskUlQ7xgcbxEzsC2JsTYuOPql3ybwiyPyDehABvC5FMh Wbqyg4ha3Q7dWBKEF/gutuMj4PlzbneGxDBy2Lmigewuzeqzo7EErFj8CLzv0W9fN7IY ZjKVNsUE49TYJ+a5EA0P+s43z7JPTwAaXmG4N/uTB0EdTljzmwTT1R56JEeWuXdsYmOR Kkp8EtbGzk/PJNBtv+EfpnpIlKx7qQP422f/0UBg+g6RCC+4es6ZK54JE7TdXU/CGFy3 vu4TFSF1kzJ7Vm0v+o/46BxEeyjZQhfEy+yQEPJVMNWyXVvq6BaeEISi70PxnAbiJ9+z SzvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2TCBI/PBpDL1NHcOhIQ+uhvSm8Uq53rPu6VzsFICHZo=; b=WihuzgQh+enSd8zaEQBRsnHYhoEgxSMvUivS+x5WIp+74O1p77e1FD32+3FKtwcz5U wA0g7lTkORcwoCgNrw7uydePht3ATbbiONN07Yq0vg8ScKfZX1f1gzBRDyoNBUBk1Fb9 xuulwlp/gGMDfiGm40xmgcgMwCdEeIhCY3usrRZltHQqT358eF7KD7b0hX41whSGLpLn MenKkRsalGEcE85r+iADa+8FJQ5iKhkZU1xj3Q9Pxxa9I2swi7Xu0LkVxP6T92csHUhb RrXpihtRsGB83tsHadIqcYaBNWFCegDoV66kMbEv2KQ6u10bqIolS8nfYhNUSQIdkXPO RRRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uj+Fniap; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si6444518edk.242.2020.10.11.19.24.41; Sun, 11 Oct 2020 19:25:04 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uj+Fniap; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727350AbgJLBVW (ORCPT + 99 others); Sun, 11 Oct 2020 21:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727132AbgJLBVV (ORCPT ); Sun, 11 Oct 2020 21:21:21 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FCAFC0613CE; Sun, 11 Oct 2020 18:21:20 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id a7so15570612lfk.9; Sun, 11 Oct 2020 18:21:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2TCBI/PBpDL1NHcOhIQ+uhvSm8Uq53rPu6VzsFICHZo=; b=Uj+Fniap6lqy6beyyGRanUdT9p4CR923o/wKlh++OTF+hqYPBtfLpEEJP5vRvAQM6L +aK3Qz83hOm6QPZ0VVdYpWFc9sFOIuSsd6cI0YJVOl1U1CdPxIsz9+2r4rKU404DZcFH NaFA4FyiYCIIzzG/an8/TvglN66Q/pC+IUZUKfW8IP0sgQiDKnHNLMQs1fbOab/tavXq rh2EazE9gIkp7OLyyPYDmpgEk5sqBIwfmmFGNGEUA6N+a7Y3JiL+N72NecHVMBWNfuPb 4XNvuFqcSUIS7zTzvKIwaalLunuQsRzqhV+ZWweNzLf1Hp4Pqni4A/EDE12KcjgNdNx1 7OCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2TCBI/PBpDL1NHcOhIQ+uhvSm8Uq53rPu6VzsFICHZo=; b=oRsFLIIAjqcXQgzE693Wdtk7qPPmNcOn4luL3Q1zW1btl9c26KpP0FLqAbbOk1pUUj tKxf73SYEXs1G3PZK3OrsaTjQ3TrX9yujTOh5oSSfg8rRwB2mdEzLSZVA9m9Yr4RaMfR N6wQq9mo/0I1Mu+bcuIj72Uv7wXTyNERA45j8Rpo7HCLv3aoelAhoDVEA27qHv7CdyuV 1ECmBVibNXmLXbx7lrjp1GxAOP6oRVMqEirbhEO1mOeOzdlxJc0737u74swEbK4nakCt OaNXtlwkzky6bn/qyAzvRx2rsFyxuHTQG2ECnydqyu784JL5kPeHru0Wk7vri2LfWmqR 41Bw== X-Gm-Message-State: AOAM530cJLlOSPBcKFXP3hbWTqiQvvjB6NEX/pLvLqNzgCFrEKSPg7xl aX2rsysSHrtpjzAeKX/+xePCn/KXacO71k+c1ak= X-Received: by 2002:ac2:58d2:: with SMTP id u18mr5895982lfo.390.1602465678557; Sun, 11 Oct 2020 18:21:18 -0700 (PDT) MIME-Version: 1.0 References: <20201010084417.5400-1-tian.xianting@h3c.com> In-Reply-To: <20201010084417.5400-1-tian.xianting@h3c.com> From: Alexei Starovoitov Date: Sun, 11 Oct 2020 18:21:07 -0700 Message-ID: Subject: Re: [PATCH] bpf: Avoid allocing memory on memoryless numa node To: Xianting Tian Cc: Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , KP Singh , Network Development , bpf , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 10, 2020 at 1:55 AM 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. ... > /* Have map->numa_node, but choose node of redirect target CPU */ > - numa = cpu_to_node(cpu); > + numa = local_memory_node(cpu_to_node(cpu)); There are so many calls to cpu_to_node() throughout the kernel. Are you going to convert all of them one patch at a time to the above sequence? Why not do this CONFIG_HAVE_MEMORYLESS_NODES in cpu_to_node() instead? and save the churn.