zoukankan      html  css  js  c++  java
  • [dpdk] dpdk --lcores参数

    dpdk程序的命令行参数 --lcores可以设置lcore到CPU processer的多对多映射关系。
    这样既可以提供CPU processor的伸缩扩展,同时也保证了EAL thread的运行环境,只需要简单的修改一下配置,基本上不需要做太多的代码调整。

    dpdk文档传送门

    摘录官网文档的描述:

    The term “lcore” refers to an EAL thread, which is really a Linux/FreeBSD pthread. “EAL pthreads” are created and managed by EAL and execute the tasks issued by remote_launch. In each EAL pthread, there is a TLS (Thread Local Storage) called _lcore_id for unique identification. As EAL pthreads usually bind 1:1 to the physical CPU, the _lcore_id is typically equal to the CPU ID.
    When using multiple pthreads, however, the binding is no longer always 1:1 between an EAL pthread and a specified physical CPU. The EAL pthread may have affinity to a CPU set, and as such the _lcore_id will not be the same as the CPU ID. For this reason, there is an EAL long option ‘–lcores’ defined to assign the CPU affinity of lcores. For a specified lcore ID or ID group, the option allows setting the CPU set for that EAL pthread.
    

    语法格式:

    The format pattern:
    –lcores=’<lcore_set>[@cpu_set][,<lcore_set>[@cpu_set],...]’
    ‘lcore_set’ and ‘cpu_set’ can be a single number, range or a group.
    
    A number is a “digit([0-9]+)”; a range is “<number>-<number>”; a group is “(<number|range>[,<number|range>,...])”.
    

    做了一个测试程序 code,效果如下:

    [root@D128 dpdk_lcores]# ./build/app/test 
    EAL: Detected 4 lcore(s)
    EAL: No free hugepages reported in hugepages-1048576kB
    EAL: Probing VFIO support...
    hello from core 1
    hello from core 2
    hello from core 3
    hello from core 0
    ^C
    [root@D128 dpdk_lcores]# ./build/app/test --lcores "(0,1,2,3,4)@(0,1),(5,6,7,8)@3"
    EAL: Detected 4 lcore(s)
    EAL: No free hugepages reported in hugepages-1048576kB
    EAL: Probing VFIO support...
    hello from core 1
    hello from core 2
    hello from core 3
    hello from core 4
    hello from core 5
    hello from core 6
    hello from core 7
    hello from core 8
    hello from core 0
    
    
  • 相关阅读:
    169. Majority Element求众数
    567. Permutation in String字符串的排列(效率待提高)
    51. N-Queens N皇后
    52. N-Queens II N皇后II
    layui的form.val无法动态渲染赋值表单问题解决方法
    layui 父页面获取弹窗传递的值 和 父页面传值给子弹窗的方法
    layui搜索框,监听为空,表格重新加载
    layui form表单 input输入框获取焦点后 阻止Enter回车自动提交
    5月17日 日期格式遇到一些问题
    Layui关闭弹出层并刷新父窗口
  • 原文地址:https://www.cnblogs.com/hugetong/p/8984566.html
Copyright © 2011-2022 走看看