On Sat, Aug 06, 2022 at 01:07:31AM +0300, Vitaliy Makkoveev wrote:
> I thought you will introduce something like below. This does the
> same but it has no heuristic under the hood.
> 
> int
> sbwait_shared(struct socket *so, struct sockbuf *sb)
> {       
>         int error;
>         
>         if (so->so_proto->pr_unlock != NULL)
>                 (*so->so_proto->pr_unlock)(so);
>         error = sbwait(so, sb);
>         if (so->so_proto->pr_lock != NULL)
>                 (*so->so_proto->pr_lock)(so);
> 
>         return error;
> }

sbwait() needs the mutex for sb->sb_flags |= SB_WAIT.

sblock() also has to release the mutex while sleeping.
My sosleep_nsec() does that.

Better ideas are welcome.  Maybe some day sosleep_nsec() will always
have a shared net lock.

bluhm

Reply via email to