Re: vm_privilege for swapin thread
Michael Kelly, le jeu. 12 juin 2025 16:31:18 +0100, a ecrit:
> Memory allocation is suspended when free memory is low in a memory segment.
> I observed a number of occasions during recent stress testing when the
> kernel effectively froze because a different thread could not be swapped in.
> The swapin thread was suspended awaiting memory for stack allocation.
>
> I didn't think it was unreasonable to promote the swapin_thread to having
> vm_privilege to help overcome those situations
Indeed.
> but perhaps there is a reason not to?
I don't think there is, and particularly since it has stack privilege.
BTW, your patches do not apply well, it seems your mailer is mangling
spaces etc. Perhaps try to attach them as text files to avoid conversion
issues.
Samuel
> diff --git a/kern/thread_swap.c b/kern/thread_swap.c
> index bfb39239..7bf734f8 100644
> --- a/kern/thread_swap.c
> +++ b/kern/thread_swap.c
> @@ -193,6 +193,7 @@ static void __attribute__((noreturn))
> swapin_thread_continue(void)
>
> void swapin_thread(void)
> {
> + current_thread()->vm_privilege = 1;
> stack_privilege(current_thread());
>
> swapin_thread_continue();
>
Reply to: