Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posix: pin init functions and data for demand paging #83708

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/posix/options/barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ struct posix_barrier {
uint32_t count;
};

__pinned_bss
static struct posix_barrier posix_barrier_pool[CONFIG_MAX_PTHREAD_BARRIER_COUNT];

SYS_BITARRAY_DEFINE_STATIC(posix_barrier_bitarray, CONFIG_MAX_PTHREAD_BARRIER_COUNT);

/*
Expand Down Expand Up @@ -195,6 +197,7 @@ int pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
return 0;
}

__boot_func
static int pthread_barrier_pool_init(void)
{
int err;
Expand Down
3 changes: 3 additions & 0 deletions lib/posix/options/cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ LOG_MODULE_REGISTER(pthread_cond, CONFIG_PTHREAD_COND_LOG_LEVEL);

int64_t timespec_to_timeoutms(const struct timespec *abstime);

__pinned_bss
static struct k_condvar posix_cond_pool[CONFIG_MAX_PTHREAD_COND_COUNT];

SYS_BITARRAY_DEFINE_STATIC(posix_cond_bitarray, CONFIG_MAX_PTHREAD_COND_COUNT);

/*
Expand Down Expand Up @@ -209,6 +211,7 @@ int pthread_cond_destroy(pthread_cond_t *cvar)
return 0;
}

__boot_func
static int pthread_cond_pool_init(void)
{
int err;
Expand Down
3 changes: 3 additions & 0 deletions lib/posix/options/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ static const struct pthread_mutexattr def_attr = {
.type = PTHREAD_MUTEX_DEFAULT,
};

__pinned_bss
static struct k_mutex posix_mutex_pool[CONFIG_MAX_PTHREAD_MUTEX_COUNT];

static uint8_t posix_mutex_type[CONFIG_MAX_PTHREAD_MUTEX_COUNT];
SYS_BITARRAY_DEFINE_STATIC(posix_mutex_bitarray, CONFIG_MAX_PTHREAD_MUTEX_COUNT);

Expand Down Expand Up @@ -451,6 +453,7 @@ int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling)

#endif /* CONFIG_POSIX_THREAD_PRIO_PROTECT */

__boot_func
static int pthread_mutex_pool_init(void)
{
int err;
Expand Down
6 changes: 6 additions & 0 deletions lib/posix/options/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,17 @@ BUILD_ASSERT(CONFIG_POSIX_PTHREAD_ATTR_STACKSIZE_BITS + CONFIG_POSIX_PTHREAD_ATT

int64_t timespec_to_timeoutms(const struct timespec *abstime);
static void posix_thread_recycle(void);

__pinned_data
static sys_dlist_t posix_thread_q[] = {
SYS_DLIST_STATIC_INIT(&posix_thread_q[POSIX_THREAD_READY_Q]),
SYS_DLIST_STATIC_INIT(&posix_thread_q[POSIX_THREAD_RUN_Q]),
SYS_DLIST_STATIC_INIT(&posix_thread_q[POSIX_THREAD_DONE_Q]),
};

__pinned_bss
static struct posix_thread posix_thread_pool[CONFIG_MAX_PTHREAD_COUNT];

static SYS_SEM_DEFINE(pthread_pool_lock, 1, 1);
static int pthread_concurrency;

Expand Down Expand Up @@ -1536,6 +1541,7 @@ int pthread_sigmask(int how, const sigset_t *ZRESTRICT set, sigset_t *ZRESTRICT
return ret;
}

__boot_func
static int posix_thread_pool_init(void)
{
ARRAY_FOR_EACH_PTR(posix_thread_pool, th) {
Expand Down
Loading