kernel: Add thread setting to prevent page waits and use it in the file cache.

See inline comment: otherwise we could deadlock waiting for busy pages.

At the same time, make page_faults_allowed just an int16 and drop
atomics and extra checks, they aren't needed.

Fixes #19441.

Change-Id: I1b7cc06f66b44c3520fa36497c076ee5a6320706
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9120
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2025-03-14 18:34:06 +00:00
committed by waddlesplash
parent bf0c6bfb90
commit 20a6449385
7 changed files with 81 additions and 22 deletions
+2 -2
View File
@@ -287,8 +287,8 @@ struct Thread : TeamThreadIteratorEntry<thread_id>, KernelReferenceable {
void (*fault_handler)(void);
jmp_buf fault_handler_state;
int32 page_faults_allowed;
/* this field may only stay in debug builds in the future */
int16 page_faults_allowed;
int16 page_fault_waits_allowed;
BKernel::Team *team; // protected by team lock, thread lock, scheduler
// lock, team_lock
+2 -2
View File
@@ -68,8 +68,8 @@ void slab_init_post_sem();
void slab_init_post_thread();
// to protect code regions with interrupts turned on
void permit_page_faults(void);
void forbid_page_faults(void);
void permit_page_faults();
void forbid_page_faults();
// private kernel only extension (should be moved somewhere else):
area_id create_area_etc(team_id team, const char *name, size_t size,