Re: [RFC][PATCH 3/3] sched: User Mode Concurency Groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 17, 2022 at 12:35:29PM +0100, Peter Zijlstra wrote:
> @@ -794,16 +798,31 @@ SYSCALL_DEFINE3(umcg_ctl, u32, flags, st
>  		      UMCG_CTL_WORKER))
>  		return -EINVAL;
>  
> -	if (flags == UMCG_CTL_UNREGISTER) {
> -		if (self || !current->umcg_task)
> +	if (flags & UMCG_CTL_UNREGISTER) {
> +		int ret;
> +
> +		if (!self || self != current->umcg_task)
>  			return -EINVAL;
>  
> -		if (current->flags & PF_UMCG_WORKER) {
> -			umcg_worker_exit();
> -			// XXX wake server
> -		} else
> -			umcg_clear_task(current);
> +		current->flags &= ~PF_UMCG_WORKER;
>  
> +		ret = umcg_pin_pages();
> +		if (ret) {
> +			current->flags |= PF_UMCG_WORKER;
> +			return ret;
> +		}
> +
> +		ret = umcg_update_state(current, self, UMCG_TASK_RUNNING, UMCG_TASK_NONE);
> +		if (ret) {
> +			current->flags |= PF_UMCG_WORKER;
> +			return ret;
> +		}

Sorry, should obv only restore PF_UMCG_WORKER for workers.. /me fixes

> +
> +		if (current->flags & PF_UMCG_WORKER)
> +			umcg_wake(current);
> +
> +		umcg_unpin_pages();
> +		umcg_clear_task(current);
>  		return 0;
>  	}
>  



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux