mempool: remove non-EAL thread note from header
PATCH 1/1 mempool: remove non-EAL thread note from header
Commit 4b5062755aa7 ("mempool: allow user-owned cache") added the capability for non-EAL threads to use the mempool library by checking rte_lcore_id() before accessing the per-lcore cache. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads.
Also, fix a typo.
--- lib/librte_mempool/rte_mempool.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/librte_mempool/rte_mempool.h +1 -5
@@ -53,11 +53,7 @@* * Note: the mempool implementation is not preemptable. A lcore must * not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* (because it uses a ring which is not preemptible). */ #include <stdio.h>
Signature · 1 line
2.7.4
PATCH v2 1/1 mempool: remove non-EAL thread note from header
Commit 30e6399892276 ("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads.
Also, fix a typo.
---
v2: Changed commit message to referenced commit 30e63998 instead of 4b5062755
lib/librte_mempool/rte_mempool.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/librte_mempool/rte_mempool.h +1 -5
@@ -53,11 +53,7 @@* * Note: the mempool implementation is not preemptable. A lcore must * not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* (because it uses a ring which is not preemptible). */ #include <stdio.h>
Signature · 1 line
2.7.4
PATCH v3 1/1 mempool: remove non-EAL thread note from header
Commit 30e6399892276 ("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads.
Also, fix a typo.
---
v2: Changed commit message to referenced commit 30e63998 instead of 4b5062755
v3: Fix checkpatch error
lib/librte_mempool/rte_mempool.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/librte_mempool/rte_mempool.h +1 -5
@@ -53,11 +53,7 @@* * Note: the mempool implementation is not preemptable. A lcore must * not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* (because it uses a ring which is not preemptible). */ #include <stdio.h>
Signature · 1 line
2.7.4
Hi Gage,
Quoted 22 lines · Gage Eads
Commit
30e6399892276("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads.Also, fix a typo.
Signed-off-by Gage Eads <[email protected]>---
v2: Changed commit message to referenced commit30e63998instead of4b5062755
v3: Fix checkpatch errorlib/librte_mempool/rte_mempool.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)lib/librte_mempool/rte_mempool.h +0
-0@@ -53,11 +53,7 @@* * Note: the mempool implementation is not preemptable. A lcore must
lib/librte_mempool/rte_mempool.h line 59
Quoted 10 lines
lib/librte_mempool/rte_mempool.h +1
-5* not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* (because it uses a ring which is not preemptible). */ #include <stdio.h>
I agree the comment is not correct today. But I think we should still highlight that usual functions [ex: rte_mempool_get(), rte_mempool_put()] won't work when called on a non-EAL thread.
Maybe it could be reworded in that way:
"""
Note: the mempool implementation is not preemptable. A lcore must not be interrupted by another task that uses the same mempool (because it uses a ring which is not preemptible). Also, usual mempool functions like rte_mempool_get() or rte_mempool_put() are designed to be called from an EAL thread due to the internal per-lcore cache. When using a mempool from a non-EAL thread, a user cache has to be provided to rte_mempool_generic_get() or rte_mempool_generic_put().
"""
What do you think?
Thanks,
Olivier
Quoted 46 lines
-----Original Message-----
From: Olivier Matz [mailto:[email protected]]
Sent: Friday, March 24, 2017 9:05 AM
To: Eads, Gage <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v3] mempool: remove non-EAL thread note from headerHi Gage,
Quoted 33 lines · Gage Eads
Commit
30e6399892276("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads.Also, fix a typo.
Signed-off-by Gage Eads <[email protected]>---
v2: Changed commit message to referenced commit30e63998instead of4b5062755
v3: Fix checkpatch errorlib/librte_mempool/rte_mempool.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)lib/librte_mempool/rte_mempool.h +1
-5@@ -53,11 +53,7 @@* * Note: the mempool implementation is not preemptable. A lcore must * not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* (because it uses a ring which is not preemptible). */
Quoted 5 lines
lib/librte_mempool/rte_mempool.h line 59
Quoted 1 line
lib/librte_mempool/rte_mempool.h +0
-0#include <stdio.h> I agree the comment is not correct today. But I think we should still highlight that usual functions [ex:
rte_mempool_get(),rte_mempool_put()] won't work when called on a non-EAL thread.
My understanding is that non-EAL threads can call those functions, but their performance will suffer since they go directly to the underlying ring. Is that correct?
Quoted 13 lines
Maybe it could be reworded in that way:
"""
Note: the mempool implementation is not preemptable. A lcore must not be interrupted by another task that uses the same mempool (because it uses a ring which is not preemptible). Also, usual mempool functions likerte_mempool_get()orrte_mempool_put()are designed to be called from an EAL thread due to the internal per-lcore cache. When using a mempool from a non-EAL thread, a user cache has to be provided torte_mempool_generic_get()orrte_mempool_generic_put().
"""
Quoted 1 line
What do you think?
Agreed, this looks better. If indeed non-EAL threads can call rte_mempool_get() and _put(), perhaps the last sentence can be reworked like so?
Due to the lack of caching, rte_mempool_get() or rte_mempool_put() performance will suffer when called by non-EAL threads. Instead, non-EAL threads should call rte_mempool_generic_get() or rte_mempool_generic_put() with a user cache created with rte_mempool_cache_create().
Quoted 3 lines
Thanks,
Olivier
Hi Gage,
Quoted 44 lines · Gage
Quoted 44 lines
-----Original Message-----
From: Olivier Matz [mailto:[email protected]]
Sent: Friday, March 24, 2017 9:05 AM
To: Eads, Gage <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v3] mempool: remove non-EAL thread note from headerHi Gage,
Quoted 33 lines · Gage Eads
Commit
30e6399892276("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads.Also, fix a typo.
Signed-off-by Gage Eads <[email protected]>---
v2: Changed commit message to referenced commit30e63998instead of4b5062755
v3: Fix checkpatch errorlib/librte_mempool/rte_mempool.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)lib/librte_mempool/rte_mempool.h +1
-5@@ -53,11 +53,7 @@* * Note: the mempool implementation is not preemptable. A lcore must * not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* (because it uses a ring which is not preemptible). */
Quoted 7 lines
Quoted 5 lines
lib/librte_mempool/rte_mempool.h line 59
Quoted 1 line
lib/librte_mempool/rte_mempool.h +0
-0#include <stdio.h> I agree the comment is not correct today. But I think we should still highlight that usual functions [ex:
rte_mempool_get(),rte_mempool_put()] won't work when called on a non-EAL thread.My understanding is that non-EAL threads can call those functions, but their performance will suffer since they go directly to the underlying ring. Is that correct?
Yes, that's more correct than what I wrote :)
Quoted 14 lines
Quoted 14 lines
Maybe it could be reworded in that way:
"""
Note: the mempool implementation is not preemptable. A lcore must not be interrupted by another task that uses the same mempool (because it uses a ring which is not preemptible). Also, usual mempool functions likerte_mempool_get()orrte_mempool_put()are designed to be called from an EAL thread due to the internal per-lcore cache. When using a mempool from a non-EAL thread, a user cache has to be provided torte_mempool_generic_get()orrte_mempool_generic_put().
"""
Quoted 8 lines
Quoted 1 line
What do you think?
Agreed, this looks better. If indeed non-EAL threads can call
rte_mempool_get()and_put(), perhaps the last sentence can be reworked like so?Due to the lack of caching,
rte_mempool_get()orrte_mempool_put()performance will suffer when called by non-EAL threads. Instead, non-EAL threads should callrte_mempool_generic_get()orrte_mempool_generic_put()with a user cache created withrte_mempool_cache_create().
Looks good, thanks!
Olivier
Quoted 4 lines
Quoted 4 lines
Thanks,
Olivier
PATCH v4 1/1 mempool: update non-EAL thread note in the header
In reply to Gage EadsCommit 30e6399892276 ("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads, and replaces it with a more up-to-date note.
---
v2: Changed commit message to referenced commit 30e63998 instead of 4b5062755
v3: Fix checkpatch error
v4: Rework note to highlight non-EAL thread differences
lib/librte_mempool/rte_mempool.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
lib/librte_mempool/rte_mempool.h +9 -7
@@ -51,13 +51,15 @@* meta-data in the object data and retrieve them when allocating a * new object. * -* Note: the mempool implementation is not preemptable. A lcore must -* not be interrupted by another task that uses the same mempool -* (because it uses a ring which is not preemptable). Also, mempool -* functions must not be used outside the DPDK environment: for -* example, in linuxapp environment, a thread that is not created by -* the EAL must not use mempools. This is due to the per-lcore cache -* that won't work as rte_lcore_id() will not return a correct value. +* Note: the mempool implementation is not preemptible. An lcore must not be +* interrupted by another task that uses the same mempool (because it uses a +* ring which is not preemptible). Also, usual mempool functions like +* rte_mempool_get() or rte_mempool_put() are designed to be called from an EAL +* thread due to the internal per-lcore cache. Due to the lack of caching, +* rte_mempool_get() or rte_mempool_put() performance will suffer when called +* by non-EAL threads. Instead, non-EAL threads should call +* rte_mempool_generic_get() or rte_mempool_generic_put() with a user cache +* created with rte_mempool_cache_create(). */ #include <stdio.h>
Signature · 1 line
2.7.4
Re: [PATCH v4] mempool: update non-EAL thread note in the header
Quoted 6 lines · Gage Eads
Commit
30e6399892276("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads, and replaces it with a more up-to-date note.Signed-off-by Gage Eads <[email protected]>
Thomas Monjalon
AppliedRe: [PATCH v4] mempool: update non-EAL thread note in the header
2017-03-31 15:51, Olivier Matz:
Quoted 9 lines · Gage Eads
Quoted 6 lines
Commit
30e6399892276("mempool: support non-EAL thread") added the capability for non-EAL threads to use the mempool library. This commit removes the note indicating that the mempool library cannot be used safely by non-EAL threads, and replaces it with a more up-to-date note.Signed-off-by Gage Eads <[email protected]>Acked-by Olivier Matz <[email protected]>
Applied, thanks