On 25/01/17(Wed) 20:12, David Hill wrote:
> > splassert: yield: want 0 have 1
> > Starting stack trace...
> > yield() at yield+0xac
> > malloc() at malloc+0x406
> > ip6_setmoptions() at ip6_setmoptions+0x65
> > ip6_ctloutput() at ip6_ctloutput+0x6d9
> > sosetopt() at sosetopt+0x8e
> > sys_setsockopt() at sys_setsockopt+0x12d
> > syscall() at syscall+0x27b
> > --- syscall (number 105) ---
> > end of kernel
> > end trace frame: 0x1b1987be0028, count: 250
> > 0x1b197d24b80a:
> > End of stack trace.
> 
> Switch to NOWAIT?  Check is already there...

This is a tricky one.

Instead of allocating the mbuf in every *ctloutput() we can do like
doaccept().  Allocate the mbuf in sys_setsockopt() before grabbing 
the lock and let the various function fill it.

That needs a bit more works since all the *ctloutput() have to be
fixed in one go.

> Index: netinet6/ip6_output.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
> retrieving revision 1.221
> diff -u -p -r1.221 ip6_output.c
> --- netinet6/ip6_output.c     19 Jan 2017 14:49:19 -0000      1.221
> +++ netinet6/ip6_output.c     26 Jan 2017 01:10:58 -0000
> @@ -1902,7 +1902,7 @@ ip6_setmoptions(int optname, struct ip6_
>                * allocate one and initialize to default values.
>                */
>               im6o = (struct ip6_moptions *)
> -                     malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK);
> +                     malloc(sizeof(*im6o), M_IPMOPTS, M_NOWAIT);
>  
>               if (im6o == NULL)
>                       return (ENOBUFS);
> 

Reply via email to