Merge pull request #100 from arutk/env_exec_ctx_trylock

Enabling per-CPU freelists
This commit is contained in:
Jan Musiał
2019-09-11 11:03:32 +02:00
committed by GitHub
2 changed files with 23 additions and 1 deletions

View File

@@ -431,6 +431,11 @@ static inline void env_spinlock_lock(env_spinlock *l)
spin_lock(l);
}
static inline int env_spinlock_trylock(env_spinlock *l)
{
return spin_trylock(l) ? 0 : -OCF_ERR_NO_LOCK;
}
static inline void env_spinlock_unlock(env_spinlock *l)
{
spin_unlock(l);
@@ -616,4 +621,21 @@ static inline uint32_t env_crc32(uint32_t crc, uint8_t const *data, size_t len)
#define ENV_BUG() BUG()
#define ENV_BUG_ON(cond) BUG_ON(cond)
/* *** EXECUTION COTNEXT *** */
static inline unsigned env_get_execution_context(void)
{
return get_cpu();
}
static inline void env_put_execution_context(unsigned ctx)
{
put_cpu();
}
static inline unsigned env_get_execution_context_count(void)
{
return num_online_cpus();
}
#endif /* __OCF_ENV_H__ */

2
ocf

Submodule ocf updated: 43e8905456...9a46c402b2