get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/51665/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 51665,
    "url": "https://patches.dpdk.org/api/patches/51665/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190325192238.20940-4-yskoh@mellanox.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20190325192238.20940-4-yskoh@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190325192238.20940-4-yskoh@mellanox.com",
    "date": "2019-03-25T19:22:35",
    "name": "[v2,3/6] net/mlx5: add control of excessive memory pinning by kernel",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5bb3a78603ed03c22b65c8f8f75eff8a242cd70e",
    "submitter": {
        "id": 636,
        "url": "https://patches.dpdk.org/api/people/636/?format=api",
        "name": "Yongseok Koh",
        "email": "yskoh@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "https://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190325192238.20940-4-yskoh@mellanox.com/mbox/",
    "series": [
        {
            "id": 3907,
            "url": "https://patches.dpdk.org/api/series/3907/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=3907",
            "date": "2019-03-25T19:22:33",
            "name": "net/mlx: enable secondary process to register DMA memory",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/3907/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/51665/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/51665/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 89FC94F90;\n\tMon, 25 Mar 2019 20:23:01 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 31A434CA6\n\tfor <dev@dpdk.org>; Mon, 25 Mar 2019 20:22:52 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tyskoh@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 25 Mar 2019 21:22:48 +0200",
            "from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx\n\t[10.101.0.96])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x2PJMfrG027389;\n\tMon, 25 Mar 2019 21:22:47 +0200"
        ],
        "From": "Yongseok Koh <yskoh@mellanox.com>",
        "To": "shahafs@mellanox.com",
        "Cc": "dev@dpdk.org",
        "Date": "Mon, 25 Mar 2019 12:22:35 -0700",
        "Message-Id": "<20190325192238.20940-4-yskoh@mellanox.com>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20190325192238.20940-1-yskoh@mellanox.com>",
        "References": "<20190307074151.18815-1-yskoh@mellanox.com>\n\t<20190325192238.20940-1-yskoh@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 3/6] net/mlx5: add control of excessive memory\n\tpinning by kernel",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "A new PMD parameter (mr_ext_memseg_en) is added to control extension of\nmemseg when creating a MR. It is enabled by default.\n\nIf enabled, mlx5_mr_create() tries to maximize the range of MR\nregistration so that the LKey lookup tables on datapath become smaller and\nget the best performance. However, it may worsen memory utilization\nbecause registered memory is pinned by kernel driver. Even if a page in the\nextended chunk is freed, that doesn't become reusable until the entire\nmemory is freed and the MR is destroyed.\n\nTo make freed pages available immediately, this parameter has to be turned\noff but it could drop performance.\n\nSigned-off-by: Yongseok Koh <yskoh@mellanox.com>\nAcked-by: Shahaf Shuler <shahafs@mellanox.com>\n---\n doc/guides/nics/mlx5.rst   | 11 +++++++++++\n drivers/net/mlx5/mlx5.c    |  7 +++++++\n drivers/net/mlx5/mlx5.h    |  2 ++\n drivers/net/mlx5/mlx5_mr.c | 21 ++++++++++++++++-----\n 4 files changed, 36 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst\nindex cbe3fb4c33..d9ae91dfc1 100644\n--- a/doc/guides/nics/mlx5.rst\n+++ b/doc/guides/nics/mlx5.rst\n@@ -485,6 +485,17 @@ Run-time configuration\n \n   Disabled by default.\n \n+- ``mr_ext_memseg_en`` parameter [int]\n+\n+  A nonzero value enables extending memseg when registering DMA memory. If\n+  enabled, the number of entries in MR (Memory Region) lookup table on datapath\n+  is minimized and it benefits performance. On the other hand, it worsens memory\n+  utilization because registered memory is pinned by kernel driver. Even if a\n+  page in the extended chunk is freed, that doesn't become reusable until the\n+  entire memory is freed.\n+\n+  Enabled by default.\n+\n - ``representor`` parameter [list]\n \n   This parameter can be used to instantiate DPDK Ethernet devices from\ndiff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 840cd3d307..93c0fc8c20 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -108,6 +108,9 @@\n /* Activate Netlink support in VF mode. */\n #define MLX5_VF_NL_EN \"vf_nl_en\"\n \n+/* Enable extending memsegs when creating a MR. */\n+#define MLX5_MR_EXT_MEMSEG_EN \"mr_ext_memseg_en\"\n+\n /* Select port representors to instantiate. */\n #define MLX5_REPRESENTOR \"representor\"\n \n@@ -569,6 +572,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)\n \t\tconfig->vf_nl_en = !!tmp;\n \t} else if (strcmp(MLX5_DV_FLOW_EN, key) == 0) {\n \t\tconfig->dv_flow_en = !!tmp;\n+\t} else if (strcmp(MLX5_MR_EXT_MEMSEG_EN, key) == 0) {\n+\t\tconfig->mr_ext_memseg_en = !!tmp;\n \t} else {\n \t\tDRV_LOG(WARNING, \"%s: unknown parameter\", key);\n \t\trte_errno = EINVAL;\n@@ -610,6 +615,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)\n \t\tMLX5_L3_VXLAN_EN,\n \t\tMLX5_VF_NL_EN,\n \t\tMLX5_DV_FLOW_EN,\n+\t\tMLX5_MR_EXT_MEMSEG_EN,\n \t\tMLX5_REPRESENTOR,\n \t\tNULL,\n \t};\n@@ -1588,6 +1594,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\t.txqs_vec = MLX5_ARG_UNSET,\n \t\t.inline_max_packet_sz = MLX5_ARG_UNSET,\n \t\t.vf_nl_en = 1,\n+\t\t.mr_ext_memseg_en = 1,\n \t\t.mprq = {\n \t\t\t.enabled = 0, /* Disabled by default. */\n \t\t\t.stride_num_n = MLX5_MPRQ_STRIDE_NUM_N,\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex d8a5162bdb..37c8cd1d34 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -167,6 +167,8 @@ struct mlx5_dev_config {\n \tunsigned int tx_vec_en:1; /* Tx vector is enabled. */\n \tunsigned int rx_vec_en:1; /* Rx vector is enabled. */\n \tunsigned int mpw_hdr_dseg:1; /* Enable DSEGs in the title WQEBB. */\n+\tunsigned int mr_ext_memseg_en:1;\n+\t/* Whether memseg should be extended for MR creation. */\n \tunsigned int l3_vxlan_en:1; /* Enable L3 VXLAN flow creation. */\n \tunsigned int vf_nl_en:1; /* Enable Netlink requests in VF mode. */\n \tunsigned int dv_flow_en:1; /* Enable DV flow. */\ndiff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c\nindex e255650add..e9eda975ff 100644\n--- a/drivers/net/mlx5/mlx5_mr.c\n+++ b/drivers/net/mlx5/mlx5_mr.c\n@@ -534,6 +534,7 @@ mlx5_mr_create(struct rte_eth_dev *dev, struct mlx5_mr_cache *entry,\n \t       uintptr_t addr)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_dev_config *config = &priv->config;\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n \tconst struct rte_memseg_list *msl;\n \tconst struct rte_memseg *ms;\n@@ -569,14 +570,24 @@ mlx5_mr_create(struct rte_eth_dev *dev, struct mlx5_mr_cache *entry,\n \t */\n \tmlx5_mr_garbage_collect(dev);\n \t/*\n-\t * Find out a contiguous virtual address chunk in use, to which the\n-\t * given address belongs, in order to register maximum range. In the\n-\t * best case where mempools are not dynamically recreated and\n+\t * If enabled, find out a contiguous virtual address chunk in use, to\n+\t * which the given address belongs, in order to register maximum range.\n+\t * In the best case where mempools are not dynamically recreated and\n \t * '--socket-mem' is specified as an EAL option, it is very likely to\n \t * have only one MR(LKey) per a socket and per a hugepage-size even\n-\t * though the system memory is highly fragmented.\n+\t * though the system memory is highly fragmented. As the whole memory\n+\t * chunk will be pinned by kernel, it can't be reused unless entire\n+\t * chunk is freed from EAL.\n+\t *\n+\t * If disabled, just register one memseg (page). Then, memory\n+\t * consumption will be minimized but it may drop performance if there\n+\t * are many MRs to lookup on the datapath.\n \t */\n-\tif (!rte_memseg_contig_walk(mr_find_contig_memsegs_cb, &data)) {\n+\tif (!config->mr_ext_memseg_en) {\n+\t\tdata.msl = rte_mem_virt2memseg_list((void *)addr);\n+\t\tdata.start = RTE_ALIGN_FLOOR(addr, data.msl->page_sz);\n+\t\tdata.end = data.start + data.msl->page_sz;\n+\t} else if (!rte_memseg_contig_walk(mr_find_contig_memsegs_cb, &data)) {\n \t\tDRV_LOG(WARNING,\n \t\t\t\"port %u unable to find virtually contiguous\"\n \t\t\t\" chunk for address (%p).\"\n",
    "prefixes": [
        "v2",
        "3/6"
    ]
}