Memorymanagement vs thread safety
Tao Li
byteocean at hotmail.com
Wed Apr 10 11:40:03 CEST 2024
Hi,
In general it is not wrong to directly free mbufs from another thread assuming it is not freed twice in both threads. But a safer way for your purpose is to create shared ring buffer between these two threads. You can pass pointers of obtained mbufs from the receiving thread to the processing thread, then get the processing status back also via the ring buffer and safely free them in the same receiving thread.
Cheers,
Tao
From: Szokovacs Robert <robert.szokovacs at gamma.co.uk>
Date: Monday, 8. April 2024 at 15:25
To: users at dpdk.org <users at dpdk.org>
Subject: Memorymanagement vs thread safety
Hello,
In may application, I use separate threads to process the packets received (write them to disk or respond to them). I could not confirm to myself that is is safe to free (using rte_pktmbuf_free
) the memory returned by rte_eth_rx_burst() from a different thread than the one it was called in. Anybody can help me with this?
Thank you!
br
Szo
Robert Szokovacs
Software Developer
Tel:
0333 240 3276<tel:0333%20240%203276>
Email:
Robert.Szokovacs at gamma.co.uk<mailto:Robert.Szokovacs at gamma.co.uk>
[cid:image819850.jpg at 7A800801.FE27EB93]
[cid:image808551.jpg at 887325EE.BD0939A7]
[cid:image447703.jpg at A6076DF8.C9CBF213]
[cid:image505921.png at 28AF8B20.6BF58847]
This is an email from Gamma Telecom Ltd, trading as “Gamma”. The contents of this email are confidential to the ordinary user of the email address to which it was addressed. This email is not intended to create any legal relationship. No one else may place any reliance upon it, or copy or forward all or any of it in any form (unless otherwise notified). If you receive this email in error, please accept our apologies, we would be obliged if you would telephone our postmaster on +44 (0) 808 178 9652 or email postmaster at gamma.co.uk
Gamma Telecom Limited, a company incorporated in England and Wales, with limited liability, with registered number 04340834, and whose registered office is at The Scalpel, 18th Floor, 52 Lime Street, London EC3M 7AF and whose principal place of business is at Kings House, Kings Road West, Newbury, Berkshire, RG14 5BY.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/users/attachments/20240410/8fbfd789/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image819850.jpg
Type: image/jpeg
Size: 60772 bytes
Desc: image819850.jpg
URL: <http://mails.dpdk.org/archives/users/attachments/20240410/8fbfd789/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image808551.jpg
Type: image/jpeg
Size: 14534 bytes
Desc: image808551.jpg
URL: <http://mails.dpdk.org/archives/users/attachments/20240410/8fbfd789/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image447703.jpg
Type: image/jpeg
Size: 91601 bytes
Desc: image447703.jpg
URL: <http://mails.dpdk.org/archives/users/attachments/20240410/8fbfd789/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image505921.png
Type: image/png
Size: 18443 bytes
Desc: image505921.png
URL: <http://mails.dpdk.org/archives/users/attachments/20240410/8fbfd789/attachment-0001.png>
More information about the users
mailing list