• [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
    
    
  • 相关阅读:
    C++ Boost Thread 编程指南
    boost的Any库学习
    人生规划,关注未来,才能持续发展
    察言观色—看穿他人心理的6种方法
    MS SQL Server 2008发布与订阅
    WebService代理类中对枚举类型的序列化
    Winform注册和注销全局快捷键
    sql server中如何为数据表添加表的描述MS_Description
    如何修改SQL Server 2008数据库服务器名称
    IIS 上发布网站后编译器错误信息: CS0016: 解决办法
  • 原文地址:https://www.cnblogs.com/hugetong/p/8984566.html
Copyright © 2020-2023  润新知