From patchwork Tue Sep 13 09:47:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 76044 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1253838qgf; Tue, 13 Sep 2016 01:48:35 -0700 (PDT) X-Received: by 10.237.34.122 with SMTP id o55mr25311503qtc.15.1473756515252; Tue, 13 Sep 2016 01:48:35 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q66si14602118qkb.116.2016.09.13.01.48.34; Tue, 13 Sep 2016 01:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C4D926164F; Tue, 13 Sep 2016 08:48:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E702D61642; Tue, 13 Sep 2016 08:48:30 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 00D3861643; Tue, 13 Sep 2016 08:48:28 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by lists.linaro.org (Postfix) with ESMTPS id F356F6160D for ; Tue, 13 Sep 2016 08:48:27 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id l131so104688360lfl.2 for ; Tue, 13 Sep 2016 01:48:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=RLjImG7arOHhggOFr0zQUbfL7/BkHMc7upUhA9zFYpc=; b=aTg0IoLNFCSQmcx1WHhOeb1Xiv8T7T6xCaKnf9SZSBLpne79bB/AexuchHRnqqS5po hfPKUk4459lm5n2Q5VcDKyzjVYVYCdIbE4A3mbb5mgZfdN2maONxpzBaxZf76+LeU4rx zTz2PKhe+4PfdioQyenhfnmtkHT/RdKf1LuCsbHhXMSIrjao2jG7ljg0SboeE29no5Z5 zXS2BKlPU+X+ZIbTp88/ZysTqFg4v/jnRq+PjmoK4TM3MYt49p7CRb7Gj/8Vl/7NHwZV f1wIaYyz8pT8DP6gPE5WIUVVmS2TLTS5iRkAe0NQXE22wewBuDyKh1Es6ueUzxe8Yh8r V/gw== X-Gm-Message-State: AE9vXwM5pfbrwOBHBdunujH22kBgPElnhLvYOeEwQE1Hl458NtYiqGJvsAxzU/N5wDyQWWyK3Yk= X-Received: by 10.46.33.76 with SMTP id h73mr2527715ljh.37.1473756506478; Tue, 13 Sep 2016 01:48:26 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id e91sm3729484lji.30.2016.09.13.01.48.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Sep 2016 01:48:25 -0700 (PDT) From: Christophe Milard To: brian.brooks@linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Tue, 13 Sep 2016 11:47:46 +0200 Message-Id: <1473760066-24969-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] linux-generic: _fdserver: allocating data table dynamicaly X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The table containing the saved file-descriptors<->{context, key} couples is now dynamically malloc'd in the fd server process, hence avoiding the memory waste which happened in other process when the table was staticaly reserved in all processes. Signed-off-by: Christophe Milard --- platform/linux-generic/_fdserver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c index bf36eb2..6ad9f6e 100644 --- a/platform/linux-generic/_fdserver.c +++ b/platform/linux-generic/_fdserver.c @@ -73,7 +73,7 @@ typedef struct fdentry_s { uint64_t key; int fd; } fdentry_t; -static fdentry_t fd_table[FDSERVER_MAX_ENTRIES]; +static fdentry_t *fd_table; static int fd_table_nb_entries; /* @@ -622,6 +622,10 @@ int _odp_fdserver_init_global(void) /* TODO: pin the server on appropriate service cpu mask */ /* when (if) we can agree on the usage of service mask */ + /* allocate the space for the file descriptor<->key table: */ + fd_table = malloc(FDSERVER_MAX_ENTRIES * sizeof(fdentry_t)); + + /* wait for clients requests */ wait_requests(sock); /* Returns when server is stopped */ close(sock); exit(0);