[dpdk-dev] 回复: About the shared flock for hugepage files

白长敏 912873551 at qq.com
Tue Sep 12 05:41:53 CEST 2017

Hi Jim,

Thank you for reply, i understand it, but i still have two doubts.

1) if i have > 1 DPDK application on a machine, i can use the parameter "--file-prefix" to distinguish, it can work even if have not flock.
2) If I understand correctly, in the "map_all_hugepages()", after making the shared flock, close(fd), that is to free the flock. Then, in the "clear_hugedir()", it equal to have not flock ?

------------------ 原始邮件 ------------------
发件人: "Jim Thompson";<jim at netgate.com>;
发送时间: 2017年9月12日(星期二) 中午11:10
收件人: "白长敏"<912873551 at qq.com>; 
抄送: "dev"<dev at dpdk.org>; 
主题: Re: [dpdk-dev] About the shared flock for hugepage files


This is so you can have > 1 DPDK application on a machine and they won't use each other's hugepages. 

See, for example the comments in clear_hugedir()



On Sep 11, 2017, at 9:16 PM, 白长敏 <912873551 at qq.com> wrote:

Hi, everyone,

    I'm a developer from china, now i have a problem is about the shared flock for hugepage files in the function of "map_all_hugepages()".

as follows:
/* set shared flock on the file. */

if (flock(fd, LOCK_SH | LOCK_NB) == -1) {

        RTE_LOG(DEBUG, EAL, "%s(): Locking file failed:%s \n", __func__, strerror(errno));


        return i;



there, it gives a shared flock to each hugepage file in /mnt/huge, and close it right away. 

it makes me puzzled. Why? What doing that is for? 

I'm looking forward to your reply, thank you very much.

best regards,

More information about the dev mailing list