librte_sched: allocate memory on the given socket id

Message ID 20180927171045.103407-1-jasvinder.singh@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Cristian Dumitrescu
Headers
Series librte_sched: allocate memory on the given socket id |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jasvinder Singh Sept. 27, 2018, 5:10 p.m. UTC
  Replace rte_zmalloc() with rte_zmalloc_socket() to allocate
memory on the socket id provided by the application.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 lib/librte_sched/rte_sched.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Cristian Dumitrescu Sept. 27, 2018, 5:52 p.m. UTC | #1
> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Thursday, September 27, 2018 6:11 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: [PATCH] librte_sched: allocate memory on the given socket id
> 
> Replace rte_zmalloc() with rte_zmalloc_socket() to allocate
> memory on the socket id provided by the application.
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> ---
>  lib/librte_sched/rte_sched.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 9269e5c71..328c983b4 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -633,7 +633,8 @@ rte_sched_port_config(struct
> rte_sched_port_params *params)
>  		return NULL;
> 
>  	/* Allocate memory to store the data structures */
> -	port = rte_zmalloc("qos_params", mem_size,
> RTE_CACHE_LINE_SIZE);
> +	port = rte_zmalloc_socket("qos_params", mem_size,
> RTE_CACHE_LINE_SIZE,
> +		params->socket);
>  	if (port == NULL)
>  		return NULL;
> 
> --
> 2.17.1

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  
Cristian Dumitrescu Oct. 8, 2018, 3:57 p.m. UTC | #2
> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Thursday, September 27, 2018 6:11 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: [PATCH] librte_sched: allocate memory on the given socket id
> 
> Replace rte_zmalloc() with rte_zmalloc_socket() to allocate
> memory on the socket id provided by the application.
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> ---
>  lib/librte_sched/rte_sched.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 9269e5c71..328c983b4 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -633,7 +633,8 @@ rte_sched_port_config(struct
> rte_sched_port_params *params)
>  		return NULL;
> 
>  	/* Allocate memory to store the data structures */
> -	port = rte_zmalloc("qos_params", mem_size,
> RTE_CACHE_LINE_SIZE);
> +	port = rte_zmalloc_socket("qos_params", mem_size,
> RTE_CACHE_LINE_SIZE,
> +		params->socket);
>  	if (port == NULL)
>  		return NULL;
> 
> --
> 2.17.1

Applied to next-qos tree, thanks!
  

Patch

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 9269e5c71..328c983b4 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -633,7 +633,8 @@  rte_sched_port_config(struct rte_sched_port_params *params)
 		return NULL;
 
 	/* Allocate memory to store the data structures */
-	port = rte_zmalloc("qos_params", mem_size, RTE_CACHE_LINE_SIZE);
+	port = rte_zmalloc_socket("qos_params", mem_size, RTE_CACHE_LINE_SIZE,
+		params->socket);
 	if (port == NULL)
 		return NULL;