From owner-freebsd-arch@FreeBSD.ORG Wed Nov 27 19:36:45 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6F54F99C; Wed, 27 Nov 2013 19:36:45 +0000 (UTC) Received: from mail-qa0-x235.google.com (mail-qa0-x235.google.com [IPv6:2607:f8b0:400d:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 027252389; Wed, 27 Nov 2013 19:36:44 +0000 (UTC) Received: by mail-qa0-f53.google.com with SMTP id j5so9805744qaq.5 for ; Wed, 27 Nov 2013 11:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=4mEUWUSVnJ6zXwOvo4JC2LM0sxNvIoGqmgMEzV5PGUM=; b=je7uj2nxnRnw1xu5DXw+0WMz30Du7AUGiTp3kCdxN/WbEutGQ2jyXP/fvvD8a2WnAW btd67S7Ra3rPD9hFRqFKELt0ThaugnMOR0L4MnHI5zwFxJSIHuOKqL5godAgyu9PfAtv VO9nJABabSzH4RFOwiFvIzqj8vbyOnRA9+eprI49edE9Yrxqoe/OZQOWPplyYhVxJwWn HCipZQRvMlLKriK2OcV2KETsoeyUWFtmUrY2BACt9sSqYglLu6OF185uJPLq3LbLFL+O aTQBIfTTvy+eJ58qWXNBRZsxgcJxhoeEKEYSFaO5b0kpRtekYLr9iboLV1Gwhsls9UbZ D2RQ== MIME-Version: 1.0 X-Received: by 10.229.56.200 with SMTP id z8mr69229405qcg.1.1385581004120; Wed, 27 Nov 2013 11:36:44 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Wed, 27 Nov 2013 11:36:44 -0800 (PST) Date: Wed, 27 Nov 2013 11:36:44 -0800 X-Google-Sender-Auth: EHAFstJ03Ts9iXCGhgrkajCtdL4 Message-ID: Subject: [review] sendfile / sendfile_sync refactoring From: Adrian Chadd To: "freebsd-arch@freebsd.org" , freebsd-current , Konstantin Belousov , Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Nov 2013 19:36:45 -0000 Hi, Here's part #2 in my sendfile refactoring. This is a little more intrusive than the first patch. http://people.freebsd.org/~adrian/netflix/20131126-sendfile-sync-refactor-2.diff My aim here is to move the sendfile_sync stuff out of uipc_syscalls.c and out of sendfile-only code and into something that can be reused elsewhere or replaced later on. I've created methods for all the sendfile_sync stuff, I've moved it out of the do_sendfile() loop so do_sendfile() doesn't specifically implement the completion behaviour. Initially, I'm going to implement a sendfile knote representing the completion of this particular mbuf transaction. I also have a vague, handwav-y idea to use this kind of mbuf transaction representation for later work with aio_write() (and maybe an aio_writev()) when writing to a socket - wire in the userland memory, create a chain of mbufs to represent those, wrap them up in a sendfile_sync (or whatever it mutates into) and then use that for the kqueue completion notification. It needs the same kind of mbuf transaction and kqueue notification mechanism so I'd like to eventually make the sendfile_sync stuff generic, or use the memory buffer representation from jhb, to implement this in a variety of places. I'm not entirely happy where the sendfile_sync stuff is living but this is all meant to be transition-y and enable further hacking on sendfile / variations thereof without having to duplicate too much code. Thanks, -adrian