Fix RCU TODOs
- Update allocate_new_qp_group to take unsigned int - Move id_ctr in rcu_lock_st for better stack alignment Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26972)
This commit is contained in:
parent
2fb4cfe143
commit
7097d2e00e
2 changed files with 8 additions and 14 deletions
|
@ -217,13 +217,12 @@ struct rcu_lock_st {
|
||||||
/* The context we are being created against */
|
/* The context we are being created against */
|
||||||
OSSL_LIB_CTX *ctx;
|
OSSL_LIB_CTX *ctx;
|
||||||
|
|
||||||
/* rcu generation counter for in-order retirement */
|
|
||||||
uint32_t id_ctr;
|
|
||||||
|
|
||||||
/* TODO: can be moved before id_ctr for better alignment */
|
|
||||||
/* Array of quiescent points for synchronization */
|
/* Array of quiescent points for synchronization */
|
||||||
struct rcu_qp *qp_group;
|
struct rcu_qp *qp_group;
|
||||||
|
|
||||||
|
/* rcu generation counter for in-order retirement */
|
||||||
|
uint32_t id_ctr;
|
||||||
|
|
||||||
/* Number of elements in qp_group array */
|
/* Number of elements in qp_group array */
|
||||||
uint32_t group_count;
|
uint32_t group_count;
|
||||||
|
|
||||||
|
@ -422,10 +421,8 @@ static void retire_qp(CRYPTO_RCU_LOCK *lock, struct rcu_qp *qp)
|
||||||
pthread_mutex_unlock(&lock->alloc_lock);
|
pthread_mutex_unlock(&lock->alloc_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: count should be unsigned, e.g uint32_t */
|
|
||||||
/* a negative value could result in unexpected behaviour */
|
|
||||||
static struct rcu_qp *allocate_new_qp_group(CRYPTO_RCU_LOCK *lock,
|
static struct rcu_qp *allocate_new_qp_group(CRYPTO_RCU_LOCK *lock,
|
||||||
int count)
|
uint32_t count)
|
||||||
{
|
{
|
||||||
struct rcu_qp *new =
|
struct rcu_qp *new =
|
||||||
OPENSSL_zalloc(sizeof(*new) * count);
|
OPENSSL_zalloc(sizeof(*new) * count);
|
||||||
|
|
|
@ -83,13 +83,12 @@ struct rcu_lock_st {
|
||||||
/* The context we are being created against */
|
/* The context we are being created against */
|
||||||
OSSL_LIB_CTX *ctx;
|
OSSL_LIB_CTX *ctx;
|
||||||
|
|
||||||
/* rcu generation counter for in-order retirement */
|
|
||||||
uint32_t id_ctr;
|
|
||||||
|
|
||||||
/* TODO: can be moved before id_ctr for better alignment */
|
|
||||||
/* Array of quiescent points for synchronization */
|
/* Array of quiescent points for synchronization */
|
||||||
struct rcu_qp *qp_group;
|
struct rcu_qp *qp_group;
|
||||||
|
|
||||||
|
/* rcu generation counter for in-order retirement */
|
||||||
|
uint32_t id_ctr;
|
||||||
|
|
||||||
/* Number of elements in qp_group array */
|
/* Number of elements in qp_group array */
|
||||||
uint32_t group_count;
|
uint32_t group_count;
|
||||||
|
|
||||||
|
@ -124,10 +123,8 @@ struct rcu_lock_st {
|
||||||
CRYPTO_RWLOCK *rw_lock;
|
CRYPTO_RWLOCK *rw_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO: count should be unsigned, e.g uint32_t */
|
|
||||||
/* a negative value could result in unexpected behaviour */
|
|
||||||
static struct rcu_qp *allocate_new_qp_group(struct rcu_lock_st *lock,
|
static struct rcu_qp *allocate_new_qp_group(struct rcu_lock_st *lock,
|
||||||
int count)
|
uint32_t count)
|
||||||
{
|
{
|
||||||
struct rcu_qp *new =
|
struct rcu_qp *new =
|
||||||
OPENSSL_zalloc(sizeof(*new) * count);
|
OPENSSL_zalloc(sizeof(*new) * count);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue