From patchwork Tue May 16 12:21:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengnan Chang X-Patchwork-Id: 126886 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6244942B22; Tue, 16 May 2023 14:21:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39AFD410EE; Tue, 16 May 2023 14:21:17 +0200 (CEST) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mails.dpdk.org (Postfix) with ESMTP id 8BAA040A8B for ; Tue, 16 May 2023 14:21:16 +0200 (CEST) Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-64390ae2eacso2590658b3a.0 for ; Tue, 16 May 2023 05:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1684239676; x=1686831676; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zDDRW24qQA+bE0FgYDR++P91oGKN8Pj5Iz2W1L/wkRc=; b=OfF4cLcFeL5ocmu2/81+BaQ7me8MH+2x40QVvTb/zWwfFVIRx+sLLSjWeGk5kSDwaC uq6ms6yQmdMKtMUtR4TfY+gj5eOienZVyVsWBWRpoS6MPvd2slNYJRTAObH67wi6o3bq U9sqO5Vgq82BkswRZZeJ+08wPwT9e6RS0U5mV2KQ/LJv8uOJpTLpbS3JQcdpVpItpEIW 4MLuj2sj3DtqRRbsY07nQdSoGwkjBqVVuSxOt8O3TWwHUH36GKOlNxCZ2Ox5JphW2A2H 1dlVMCoWScRtv+jc32kb3gL0wQ0FK0iwAcA3LLPObmz4FaEBszcs/cJe+YpSdkJ7ba86 uWHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684239676; x=1686831676; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zDDRW24qQA+bE0FgYDR++P91oGKN8Pj5Iz2W1L/wkRc=; b=j2/6JnwppH7RJRAGboBzT2upJNpcq1qfJiS0wrO1s+Th6BfGci7ZVf1gBU7tdaNC0q zmai2s88AD9Gow7nV5P5Y/ZwEZBKxS/7XZ3jkgY2VOkoYNaiCfe7iKyl13iTFzRDLSAN XjmqLUaMqaso15kpMvt2ZIn2JWbWiAlX6PS+GJngfBUtENJMhJtCkikxvq7/9uHGxm7v iOOHeM8//PdmDHWDn5oAB8kBQht0U+q2xLbAn3CDiIo/66Ivk/EpRANyoF9+MIVJnmPt IH283yHds3UEUFutyTUmnZzT7prAOKG1cpbnIZepYoz1j1BtAsHzwGXLzFKBzx+ds+7D 4trA== X-Gm-Message-State: AC+VfDz4+eTaqDWqTmM9MeooghCmHoDYiu9IZyOsid6l4Av7//5W+bf1 usXnv4pVhpSz26SgqVLHrm8ddw== X-Google-Smtp-Source: ACHHUZ6Su6AUHtqOQZXhMPvjr9reFJVayq91cnzUgkEQvHF6DO6IfAYPjU8wZ7IHq6kGMpLVcI04hA== X-Received: by 2002:a17:903:310b:b0:1ae:3dcf:ecf3 with SMTP id w11-20020a170903310b00b001ae3dcfecf3mr1144990plc.6.1684239675727; Tue, 16 May 2023 05:21:15 -0700 (PDT) Received: from HTW5T2C6VL.bytedance.net ([139.177.225.231]) by smtp.gmail.com with ESMTPSA id bf12-20020a170902b90c00b001ac95be5081sm15345230plb.307.2023.05.16.05.21.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 May 2023 05:21:15 -0700 (PDT) From: Fengnan Chang To: anatoly.burakov@intel.com, dev@dpdk.org Cc: Fengnan Chang , Lin Li Subject: [PATCH] eal: fix eal init may failed when too much continuous memsegs under legacy mode Date: Tue, 16 May 2023 20:21:08 +0800 Message-Id: <20230516122108.38617-1-changfengnan@bytedance.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 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 Under legacy mode, if the number of continuous memsegs greater than RTE_MAX_MEMSEG_PER_LIST, eal init will failed even though another memseg list is empty, because only one memseg list used to check in remap_needed_hugepages. For example: hugepage configure: 20480 13370 7110 startup log: EAL: Detected memory type: socket_id:0 hugepage_sz:2097152 EAL: Detected memory type: socket_id:1 hugepage_sz:2097152 EAL: Creating 4 segment lists: n_segs:8192 socket_id:0 hugepage_sz:2097152 EAL: Creating 4 segment lists: n_segs:8192 socket_id:1 hugepage_sz:2097152 EAL: Requesting 13370 pages of size 2MB from socket 0 EAL: Requesting 7110 pages of size 2MB from socket 1 EAL: Attempting to map 14220M on socket 1 EAL: Allocated 14220M on socket 1 EAL: Attempting to map 26740M on socket 0 EAL: Could not find space for memseg. Please increase 32768 and/or 65536 in configuration. EAL: Couldn't remap hugepage files into memseg lists EAL: FATAL: Cannot init memory EAL: Cannot init memory Signed-off-by: Fengnan Chang Signed-off-by: Lin Li --- lib/eal/linux/eal_memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c index 60fc8cc6ca..36b9e78f5f 100644 --- a/lib/eal/linux/eal_memory.c +++ b/lib/eal/linux/eal_memory.c @@ -1001,6 +1001,8 @@ remap_needed_hugepages(struct hugepage_file *hugepages, int n_pages) if (cur->size == 0) break; + if (cur_page - seg_start_page >= RTE_MAX_MEMSEG_PER_LIST) + new_memseg = 1; if (cur_page == 0) new_memseg = 1; else if (cur->socket_id != prev->socket_id)