From owner-freebsd-net@freebsd.org Wed Jan 13 08:03:55 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E41AFA802A6 for ; Wed, 13 Jan 2016 08:03:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 617C110A4 for ; Wed, 13 Jan 2016 08:03:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u0D83o2V048343 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 13 Jan 2016 10:03:50 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u0D83o2V048343 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u0D83n1Y048342; Wed, 13 Jan 2016 10:03:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 13 Jan 2016 10:03:49 +0200 From: Konstantin Belousov To: Boris Astardzhiev Cc: Adrian Chadd , Mark Delany , FreeBSD Net Subject: Re: Does FreeBSD have sendmmsg or recvmmsg system calls? Message-ID: <20160113080349.GC72455@kib.kiev.ua> References: <20160107161213.GZ3625@kib.kiev.ua> <20160107192840.GF3625@kib.kiev.ua> <20160108172323.W1815@besplex.bde.org> <20160108075815.3243.qmail@f5-external.bushwire.net> <20160108204606.G2420@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2016 08:03:56 -0000 On Tue, Jan 12, 2016 at 04:53:25PM +0200, Boris Astardzhiev wrote: > Hello again, > > In my spare time I did the following simple libc-only implementation of the > syscalls. > I did some tests in a VM adapting these experiments: > https://blog.cloudflare.com/how-to-receive-a-million-packets/ > > Any comments about the diff are greatly appreciated. Please find below. This implementation has some strangeness, like NOASM and PSEUDO in makefile, which I cannot find a purpose for. Big issue with the implementation is the interposing stuff, why do you need it at all ? Is it to correctly handle cancellation, to not fall into sleepable syscall when previous loop step was cancelled ? If yes, you _can_ use pthread_testcancel(3) etc in libc. Libc provides stubs for them with trivial implementation, which is reset to the real one if libthr is loaded. Then you can simplify your patch significantly, avoiding the need for interposing and writing the loops both in libc and libthr. BTW, do you have tests for the cancellation of the new functions ? Again, the patch lacks man page updates.