X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fsvm%2Fssvm.h;h=6225a63cae40178e821b0fdaea2ae27bcab5241d;hb=b4e5e50fe;hp=59b582ecc4279d93ce6168d78a01a38e136c9a7a;hpb=d9818dd68c162079f3ddb5443a78d0d91d55d0fe;p=vpp.git diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index 59b582ecc42..6225a63cae4 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Cisco and/or its affiliates. + * Copyright (c) 2015-2019 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef MMAP_PAGESIZE #define MMAP_PAGESIZE (clib_mem_get_page_size()) @@ -81,10 +82,11 @@ typedef struct typedef struct { ssvm_shared_header_t *sh; - u64 ssvm_size; + uword ssvm_size; + uword requested_va; u32 my_pid; u8 *name; - uword requested_va; + u8 numa; /**< Numa requested at alloc time */ int i_am_master; union @@ -104,7 +106,7 @@ ssvm_lock (ssvm_shared_header_t * h, u32 my_pid, u32 tag) } while (clib_atomic_test_and_set (&h->lock)) - ; + CLIB_PAUSE (); h->owner_pid = my_pid; h->recursion_count = 1; @@ -115,7 +117,7 @@ always_inline void ssvm_lock_non_recursive (ssvm_shared_header_t * h, u32 tag) { while (clib_atomic_test_and_set (&h->lock)) - ; + CLIB_PAUSE (); h->tag = tag; } @@ -127,8 +129,7 @@ ssvm_unlock (ssvm_shared_header_t * h) { h->owner_pid = 0; h->tag = 0; - CLIB_MEMORY_BARRIER (); - h->lock = 0; + clib_atomic_release (&h->lock); } } @@ -136,8 +137,7 @@ always_inline void ssvm_unlock_non_recursive (ssvm_shared_header_t * h) { h->tag = 0; - CLIB_MEMORY_BARRIER (); - h->lock = 0; + clib_atomic_release (&h->lock); } static inline void *