From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5E65DA0C53;
	Fri,  3 Sep 2021 08:33:08 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A89C8410E6;
	Fri,  3 Sep 2021 08:32:53 +0200 (CEST)
Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com
 [209.85.210.173])
 by mails.dpdk.org (Postfix) with ESMTP id E93324003C
 for <dev@dpdk.org>; Thu,  2 Sep 2021 17:11:08 +0200 (CEST)
Received: by mail-pf1-f173.google.com with SMTP id y17so1860738pfl.13
 for <dev@dpdk.org>; Thu, 02 Sep 2021 08:11:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=zZbks3yA6lbVbKuz4oT4An05dUgJ1sEO+d8apXOuGj4=;
 b=PFz/gYW9UfjtzvIMfy+PXuzGCdZ2Z9MpSeuIzYjOH3RVJW3FR0tF7bq3ry8WuHYyLv
 zZM4OvQeuRNtXtDaALkfK0gQLtBdEzZ+8oki+N+jGRgxgE6Q+7yFpNo4e8vYNWo+LJwE
 Yt9ER/vlvaiTAMECDFxnvIhYpcNYKJ20EOkz8+uwiR31MTcWVAI96yCI25xif8Yzwh3T
 hvqnJeJS/3bEMsi5+SOLwqfQLr9+M7fcaG29hATxLSDULj+Q1P9Y4531Gs0okR5hFBzT
 ce+Dmt6iJjYnZQ/xEQ8jX3DwchPqFtdLq17fQWHRhZ7jy+iGJy+iYtmYCcsNRJpP0dba
 /+bg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=zZbks3yA6lbVbKuz4oT4An05dUgJ1sEO+d8apXOuGj4=;
 b=jhpbwCw1v7L4Gr9iY1JXx9haJdd/dYdf7z/z/zm3ycUDNW62DGiibdCwBh7/3D0mGP
 u/jimqxIONwEvDXeEtczIj8UyRQ1fB3m8ifoWhVvM7c9+rghb3o1EefbBvgBLeb20jxI
 KIFeULejP8J3XAHfMFYO364boCVoCZzLqTENpBCI/YsGESFPeULgXzraU3fUXaeudKIT
 ZL6FGMLaddIKwVdHEtjdmCjqfijqsE6QXTtlorGFdvseHjfGhc4ERqkILIA6WleUYj8w
 8eZSHOaJ4o45s1WGal9cz0dlN4I3Oj6AAzbZNVyZ8vXmJyRpumHFXb1q3Ay69shYjQ7o
 4DTQ==
X-Gm-Message-State: AOAM530FDTOucImgrPBD26UcR+PzlzhD8EqDflrZwe4iFiBYpd0J2x3J
 oIhMGgacU8zR9Q0V55OjhZLA/qJVdNGIEA==
X-Google-Smtp-Source: ABdhPJyJ7N+eeegfcEKoPua7w++V3dZ6t8ZQaIno1KwovsoUR+X6EeTzwTDzS7X8Xvf1D1HtE2j4aw==
X-Received: by 2002:a63:f145:: with SMTP id o5mr3649000pgk.273.1630595467707; 
 Thu, 02 Sep 2021 08:11:07 -0700 (PDT)
Received: from localhost.localdomain (74.120.174.58.16clouds.com.
 [74.120.174.58])
 by smtp.gmail.com with ESMTPSA id l12sm3017526pgc.41.2021.09.02.08.11.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Sep 2021 08:11:07 -0700 (PDT)
From: Kefu Chai <tchaikov@gmail.com>
To: dev@dpdk.org
Cc: Kefu Chai <tchaikov@gmail.com>,
 Bruce Richardson <bruce.richardson@intel.com>
Date: Thu,  2 Sep 2021 23:11:00 +0800
Message-Id: <20210902151100.140330-1-tchaikov@gmail.com>
X-Mailer: git-send-email 2.33.0
In-Reply-To: <20210902144805.105098-1-tchaikov@gmail.com>
References: <20210902144805.105098-1-tchaikov@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Mailman-Approved-At: Fri, 03 Sep 2021 08:32:48 +0200
Subject: [dpdk-dev] [PATCH v3] build: add meson options of max_memseg_lists
 and atomic_mbuf_ref_counts
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

RTE_MAX_MEMSEG_LISTS = 128 is not enough for high-memory machines, in our case,
we need to increase it to 8192. so add an option so user can override it.
RTE_MBUF_REFCNT_ATOMIC = 0 is not necessary for applications like Seastar,
where it's safe to assume that the mbuf refcnt is only updated by a single
core only.

---
v3:

* s/mbuf_refcnt_atomic/atomic_mbuf_ref_counts/, and update the 
  title of the commit message accordingly
* explain the expected number of MEMSEG_LISTS in commit message.
* remove the empty line after the newly added option

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
---
 config/meson.build  | 5 ++++-
 config/rte_config.h | 2 --
 meson_options.txt   | 4 ++++
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 3b5966ec2f..d95dccdbcc 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -301,7 +301,10 @@ if dpdk_conf.get('RTE_ARCH_64')
 else # for 32-bit we need smaller reserved memory areas
     dpdk_conf.set('RTE_MAX_MEM_MB', 2048)
 endif
-
+dpdk_conf.set('RTE_MAX_MEMSEG_LISTS', get_option('max_memseg_lists'))
+if get_option('atomic_mbuf_ref_counts')
+  dpdk_conf.set('RTE_MBUF_REFCNT_ATOMIC', true)
+endif
 
 compile_time_cpuflags = []
 subdir(arch_subdir)
diff --git a/config/rte_config.h b/config/rte_config.h
index 590903c07d..0a659f5e1a 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -29,7 +29,6 @@
 
 /* EAL defines */
 #define RTE_MAX_HEAPS 32
-#define RTE_MAX_MEMSEG_LISTS 128
 #define RTE_MAX_MEMSEG_PER_LIST 8192
 #define RTE_MAX_MEM_MB_PER_LIST 32768
 #define RTE_MAX_MEMSEG_PER_TYPE 32768
@@ -50,7 +49,6 @@
 
 /* mbuf defines */
 #define RTE_MBUF_DEFAULT_MEMPOOL_OPS "ring_mp_mc"
-#define RTE_MBUF_REFCNT_ATOMIC 1
 #define RTE_PKTMBUF_HEADROOM 128
 
 /* ether defines */
diff --git a/meson_options.txt b/meson_options.txt
index 0e92734c49..6aeae211cd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -38,6 +38,10 @@ option('max_lcores', type: 'integer', value: 128, description:
        'maximum number of cores/threads supported by EAL')
 option('max_numa_nodes', type: 'integer', value: 32, description:
        'maximum number of NUMA nodes supported by EAL')
+option('max_memseg_lists', type: 'integer', value: 128, description:
+       'maximum number of dynamic arrays holding memsegs')
+option('atomic_mbuf_ref_counts', type: 'boolean', value: true, description:
+       'atomically access the mbuf refcnt')
 option('platform', type: 'string', value: 'native', description:
        'Platform to build, either "native", "generic" or a SoC. Please refer to the Linux build guide for more information.')
 option('enable_trace_fp', type: 'boolean', value: false, description:
-- 
2.33.0