diff mbox

[2/2] linux-generic: pool: accelerate buffer allocation marking

Message ID 1446746528-25786-2-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit 982582eda1058f8e43335c42ae0853cc8cd47f28
Headers show

Commit Message

Bill Fischofer Nov. 5, 2015, 6:02 p.m. UTC
Since we're now caching the local thread ID for cache management, use
this copy for buffer allocation marking as well to avoid unneeded calls
to odp_thread_id()

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/odp_pool_internal.h | 2 --
 platform/linux-generic/odp_pool.c                  | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Bill Fischofer Jan. 25, 2016, 12:54 a.m. UTC | #1
ping

On Thu, Nov 5, 2015 at 12:02 PM, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> Since we're now caching the local thread ID for cache management, use

> this copy for buffer allocation marking as well to avoid unneeded calls

> to odp_thread_id()

>

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  platform/linux-generic/include/odp_pool_internal.h | 2 --

>  platform/linux-generic/odp_pool.c                  | 3 +++

>  2 files changed, 3 insertions(+), 2 deletions(-)

>

> diff --git a/platform/linux-generic/include/odp_pool_internal.h

> b/platform/linux-generic/include/odp_pool_internal.h

> index 94bf1fa..fb51119 100644

> --- a/platform/linux-generic/include/odp_pool_internal.h

> +++ b/platform/linux-generic/include/odp_pool_internal.h

> @@ -214,7 +214,6 @@ static inline odp_buffer_hdr_t *get_buf(struct

> pool_entry_s *pool)

>                 }

>

>                 odp_atomic_inc_u64(&pool->poolstats.bufallocs);

> -               myhead->allocator = odp_thread_id();

>         }

>

>         return (void *)myhead;

> @@ -276,7 +275,6 @@ static inline void *get_local_buf(local_cache_t

> *buf_cache,

>                 }

>

>                 buf_cache->bufallocs++;

> -               buf->allocator = odp_thread_id();  /* Mark buffer

> allocated */

>         }

>

>         return buf;

> diff --git a/platform/linux-generic/odp_pool.c

> b/platform/linux-generic/odp_pool.c

> index 9fd64d6..638b387 100644

> --- a/platform/linux-generic/odp_pool.c

> +++ b/platform/linux-generic/odp_pool.c

> @@ -520,6 +520,9 @@ odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t

> size)

>                 }

>         }

>

> +       /* Mark buffer as allocated */

> +       buf->buf.allocator = local_id;

> +

>         /* By default, buffers inherit their pool's zeroization setting */

>         buf->buf.flags.zeroized = pool->s.flags.zeroized;

>

> --

> 2.1.4

>

>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index 94bf1fa..fb51119 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -214,7 +214,6 @@  static inline odp_buffer_hdr_t *get_buf(struct pool_entry_s *pool)
 		}
 
 		odp_atomic_inc_u64(&pool->poolstats.bufallocs);
-		myhead->allocator = odp_thread_id();
 	}
 
 	return (void *)myhead;
@@ -276,7 +275,6 @@  static inline void *get_local_buf(local_cache_t *buf_cache,
 		}
 
 		buf_cache->bufallocs++;
-		buf->allocator = odp_thread_id();  /* Mark buffer allocated */
 	}
 
 	return buf;
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 9fd64d6..638b387 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -520,6 +520,9 @@  odp_buffer_t buffer_alloc(odp_pool_t pool_hdl, size_t size)
 		}
 	}
 
+	/* Mark buffer as allocated */
+	buf->buf.allocator = local_id;
+
 	/* By default, buffers inherit their pool's zeroization setting */
 	buf->buf.flags.zeroized = pool->s.flags.zeroized;