From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA26941B88; Tue, 31 Jan 2023 04:24:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9DF440EF0; Tue, 31 Jan 2023 04:24:00 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id D29C540DFB for ; Tue, 31 Jan 2023 04:23:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675135438; x=1706671438; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Npl1sRvbwI+FKjeDipQd2h3FvXbwQcQOGVqFNtGDnRA=; b=HgtST3tRxkUMisvS57gdiiUHjDPPmEy4eSDew6zs9oQ0CRppYMwzy5fi QciiOrJuScx+VaSlA3xvOrRmOHs036755sKXwVRUB+1YoOAwKaR+x7LAa O+u++qV1Ri76EHIsUKLs1G2Hr8l6w0GyKMZtLstMz1t0trZ/ieuoVeiwf aStJWLlqx4OsXX5Iqd/aajgl7UVOytHYdqmCt2pjD8SH/U0yB3ECLHhxT VBOwWNkQgYbD1rGK3dsdASHk5Wc2QVrqEvJqbRfRUt0XSJAodWXjQ/cHX OIoZMmX4zmOZBeCk4Fm9bi6o9OQgB+dcYPJRZEoTUZgtMNFXlY38TypqO Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="329012263" X-IronPort-AV: E=Sophos;i="5.97,259,1669104000"; d="scan'208";a="329012263" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 19:23:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10606"; a="727763173" X-IronPort-AV: E=Sophos;i="5.97,259,1669104000"; d="scan'208";a="727763173" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 30 Jan 2023 19:23:51 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 30 Jan 2023 19:23:50 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 30 Jan 2023 19:23:50 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Mon, 30 Jan 2023 19:23:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l7gbQTV+HaFh9yb8koX9sXS5cDOcUivZhytDvc4k+MoP7LM1Mr1/FHFTh3To1K5w8ybLw0BeVUNFqGK3x3Zxum/h04r5KgEx5myNnhaFPDSeNHH8o0bOSqo6ufb6Kxg6tMz6A5w2bEzANj/XotPMz492Uh8W8MTFxxxREa2xTnQHpY3c0iLZhPO6kGri6x6HtQZx/BOqARXJmPsrqZCzgMQAmLyiISErXtk9atXOKVUNGgUbZx7dM+Cj4EKgP86tOobrYh2E2QIumd32w0MwyW1d8YDP7Sbk1gF3apTKVsJoapYGnOAfeVW8FGNs5SnHr8763Gdlc0bUdbrLZ2o1Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wVl1kMVdPcoCiUqWzRu8LI+vLls9jxgXw/ADCZTSFck=; b=mFwTgiu08QNgA2+nSszikfVSdQVPlsRDgamp08Qs+zpAT90mxOIfyNTygNQeSKLVij37LJhHFkIFXDOAcJ8QaNUQ0Ipwhv0D8cPWn8ryzxZrPWVYGWt53yQ+ukW258ek03fUgSePzcph1J1JpYlWEcwUCRzbUcCNnY2uITDx+C6s2fzcQ8dNwjIVIuuAZpU+qRV6c58iat/PZxyFp+UDPHo0qBnmRUDPVpHMET95HU7103wLxTii/9Nk38W+DZJYfxNfeilPTvGbroYJ1Da5SfzQAnA3h+SDecvv9k6A5Hp/kjvYCbn9WkM5g5ifvtIz9LX1wTqnm6gqjuxGLbjhJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SJ0PR11MB6765.namprd11.prod.outlook.com (2603:10b6:a03:47b::10) by BN9PR11MB5306.namprd11.prod.outlook.com (2603:10b6:408:137::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Tue, 31 Jan 2023 03:23:47 +0000 Received: from SJ0PR11MB6765.namprd11.prod.outlook.com ([fe80::7caf:d35f:f12f:db66]) by SJ0PR11MB6765.namprd11.prod.outlook.com ([fe80::7caf:d35f:f12f:db66%7]) with mapi id 15.20.6043.038; Tue, 31 Jan 2023 03:23:46 +0000 From: "You, KaisenX" To: David Marchand , "dev@dpdk.org" CC: "Matz, Olivier" , "ferruh.yigit@amd.com" , "zhoumin@loongson.cn" , "Burakov, Anatoly" Subject: RE: [PATCH v3] malloc: enhance NUMA affinity heuristic Thread-Topic: [PATCH v3] malloc: enhance NUMA affinity heuristic Thread-Index: AQHZH3fj5InaG/QEv0KpaZjrnesQaK64B32w Date: Tue, 31 Jan 2023 03:23:46 +0000 Message-ID: References: <20221221104858.296530-1-david.marchand@redhat.com> <20230103133216.961495-1-david.marchand@redhat.com> In-Reply-To: <20230103133216.961495-1-david.marchand@redhat.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR11MB6765:EE_|BN9PR11MB5306:EE_ x-ms-office365-filtering-correlation-id: f6774330-741b-4e54-d097-08db033a904a x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: z9ZqbCNRnw/WmizysRjoPbIzmNfWMF8MMLIPXhR9IMb5AY6rT+YnoOaIIxlecdGWY3laSl6LMTDWQpaMqBoZAwDCZhaQqjmBWgI7MKIO2pie49X0JQDNd3Pasdrk8eaxbUcQCWUH/8Rc2JKGFgJRg1bUHYisQIXS4cB1Gd6sdtvZtmtYWxdIdWLzn9ms6ZKutUx0cCkovEcFv7/Z/61LmKtIs/sWk33lgXSHCWiEpqxhhYqxdmR5fp/g+mp1auYNF0t/b34+D+nCrCK7AmYtXh2HEBpFCyeJxZayB2zXMeLx79AvUZcu4TM6oLZJVPsso74+xoXrIc5lJ13VWGodfru4bgRFXIX027j+VlQP/TTyxyuqLvY4HteZSP9EQe5cmfTy+/3iZeztp/3r6+B8PVYXKXYjtRf5V31LjTSi4fSIY7BSQ0XjbCoBwDJr5emn7uhOnzN5FITLuDHobRnbHZ0/dSvSvxtVJdHs8zj9xipVGRRQvWFDbujCGdKBV7FMwsk3ibac3ISiZxT0Bqn3vAP/DIef/U8GZufzMZCbhQ6RVkIPVh0brN74kK/KkITUOAMZrbaR7BuJ8SRJhnATMs/ZtXKRcpZPMrTo9xrtKegDiNKXoSnuCanivJhViysHySaw85W5sa2W2qfwOMh7hqRaeUZP5+WNdihviM+LXdFsjQkJtGPy5K4cj72q6FDD7/Tfh0jrRQeDqBpMLNeWeg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB6765.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(346002)(136003)(376002)(366004)(39860400002)(451199018)(2906002)(52536014)(5660300002)(38070700005)(86362001)(82960400001)(83380400001)(8936002)(41300700001)(478600001)(71200400001)(26005)(9686003)(7696005)(186003)(6506007)(53546011)(107886003)(33656002)(110136005)(54906003)(4326008)(66476007)(66446008)(38100700002)(8676002)(66946007)(76116006)(66556008)(64756008)(122000001)(316002)(55016003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?B?cHJ0T3ZxQytSWndiQUsxZHBBc1I2K2lBWmkyNStIeVRBRnlkRnFFNFFV?= =?iso-2022-jp?B?TTRUVXBoTGhLL2RmR0xuelhDTi9sMmRYQU1FcmpUVXhJTUtkU3dndGkx?= =?iso-2022-jp?B?SUVwWjR0WUR0NkhRTUkzNnVnRldXWEFBWFBHdStqL0xzTW5CTU05aXNH?= =?iso-2022-jp?B?ZzBFaVpwckhPVHhvYTNvVkw1cUFEU09xNzhGM1RJbTlZQnZNRTFncTdv?= =?iso-2022-jp?B?Y0d1cEhzM0lKa0s0NDE4LzI5clNiRUdaeDA3ZjBEeXVZMk5VUnR6WitB?= =?iso-2022-jp?B?VklFcVBBQlRaS0hjbXE0a1VKVlJWUkJqczd4U1EyMkQxZU9pMDRtWVIx?= =?iso-2022-jp?B?Q3hVSG5tMjlzam40RDdZQTBpVUhPUUMrc2xRYlhISndSN1dSMjRvSGw0?= =?iso-2022-jp?B?c2l2WHVtMzFXc1hjYVJLYTY1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=?iso-2022-jp?B?eHNuN1BINmpEblhsYjRwcVZncEZUWmVhR2pjM25jNmFkQXBaZlVvZzFt?= =?iso-2022-jp?B?QVJmaw==?= Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB6765.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6774330-741b-4e54-d097-08db033a904a X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2023 03:23:46.6240 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7vzrmuMpC2v6ZIz0ZQgNnzc6xA868XmExROwjoQw6jDax3WdeXag5xoBvxPMse578mpctFUGGaCuRIp9/Tfymw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5306 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: David Marchand > Sent: 2023=1B$BG/=1B(B1=1B$B7n=1B(B3=1B$BF|=1B(B 21:32 > To: dev@dpdk.org > Cc: Matz, Olivier ; ferruh.yigit@amd.com; You, > KaisenX ; zhoumin@loongson.cn; Burakov, Anatoly > > Subject: [PATCH v3] malloc: enhance NUMA affinity heuristic >=20 > Trying to allocate memory on the first detected numa node has less chance > to find some memory actually available rather than on the main lcore numa > node (especially when the DPDK application is started only on one numa > node). >=20 > Signed-off-by: David Marchand > --- > Changes since v2: > - add uncommitted local change and fix compilation, >=20 > Changes since v1: > - accomodate for configurations with main lcore running on multiples > physical cores belonging to different numa, >=20 > --- > lib/eal/common/malloc_heap.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c > index d7c410b786..3ee19aee15 100644 > --- a/lib/eal/common/malloc_heap.c > +++ b/lib/eal/common/malloc_heap.c > @@ -717,6 +717,10 @@ malloc_get_numa_socket(void) > return socket_id; > } >=20 > + socket_id =3D rte_lcore_to_socket_id(rte_get_main_lcore()); > + if (socket_id !=3D (unsigned int)SOCKET_ID_ANY) > + return socket_id; > + > return rte_socket_id_by_idx(0); > } >=20 Because the initial "socket_id" of the interrupt thread is not necessarily= =20 "SOCKET_ID_ANY"(-1), in malloc_get_numa_socket(void) function, It may=20 be returned before the content modified by this patch, resulting in the=20 subsequent search for memory being performed on the socket that initializes= =20 the unallocated memory.=20 To avoid this, I will submit the V4 version to fix this problem. > -- > 2.39.0