[PATCH v2 08/10] um: nommu: add userspace runner processes

Johannes Berg johannes at sipsolutions.net
Thu Jul 23 06:59:44 PDT 2026


On Thu, 2026-07-23 at 11:35 +0200, Johannes Berg wrote:
> 
> +struct mutex *__get_turnstile(struct mm_id *mm_id)
> +{
> +	return &container_of(mm_id, struct nommu_runner, mm_id)->turnstile;
> +}
> +
> +void enter_turnstile(struct mm_id *mm_id)
> +{
> +	mutex_lock(__get_turnstile(mm_id));
> +}
> +
> +void exit_turnstile(struct mm_id *mm_id)
> +{
> +	mutex_unlock(__get_turnstile(mm_id));
> +}

I should comment on this - it really shouldn't be necessary here, and
the mutex should never be contended. Also, __get_turnstile() is only
needed for context tracking, so I'm not even sure it matters what it
returns (I don't fully understand the clang context tracking).

I was tempted to make the mutex_lock() something like

	if (WARN_ON(!try_mutex_lock()))
		mutex_lock();

but eventually decided to just keep it. I think we'll probably want to
remove the whole turnstile business entirely anyway, and have real SMP
for userspace threads. In fact I started prototyping this as well, but
didn't have time to finish it yet.

So all this really is a bit of just fluff right now and hopefully will
eventually go away.

johannes



More information about the linux-um mailing list