From owner-freebsd-current@FreeBSD.ORG Thu Jul 11 08:37:20 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8DF566B for ; Thu, 11 Jul 2013 08:37:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [IPv6:2a00:1450:400c:c03::22a]) by mx1.freebsd.org (Postfix) with ESMTP id 45BF91AED for ; Thu, 11 Jul 2013 08:37:20 +0000 (UTC) Received: by mail-we0-f170.google.com with SMTP id w57so6801661wes.15 for ; Thu, 11 Jul 2013 01:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=mRwaJHMnUkVy+eXCZ0f5LmS1FzOPxrFBAEaWtRz5dDk=; b=QBbM0gGNWWu19KTVme9P4QA2K9IM+ORQeHzidM0p+cZO7bQlXjjylUpRat6z7O6HG0 Vo192sczx+qzi5jxyLwKF+MUnABJXBY0iqMiKAW5kP7CordnwbjSbJGtzkKFdxJFMO8f Tx7pijHQYkdEcfWY2C9aklE3+R5CLCfXcNsv17+y4Wn8KVkbYHMlJMc52qIJO5cMwi1L izEmF42ZLQ+/ZhsteeTvrJtXIwqpHFjgbJwOcnZsopvTxjxkvMLUNaSyM6yo5RHXmIDp dCv2c+XuLVo1Vz/01tsU8ZPDBihh0YzBtBmVLM19bATvardEtniD1qtHH0aJKuXKHGce sVnQ== MIME-Version: 1.0 X-Received: by 10.180.37.133 with SMTP id y5mr19555715wij.30.1373531839261; Thu, 11 Jul 2013 01:37:19 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.94.132 with HTTP; Thu, 11 Jul 2013 01:37:19 -0700 (PDT) In-Reply-To: <20130711061753.GK91021@kib.kiev.ua> References: <20130711061753.GK91021@kib.kiev.ua> Date: Thu, 11 Jul 2013 01:37:19 -0700 X-Google-Sender-Auth: qliHbYyk-RYdp-FWb6vNXB0xcBQ Message-ID: Subject: Re: hacking - aio_sendfile() From: Adrian Chadd To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2013 08:37:20 -0000 Hiya, I'm more interested in the API than the implementation at the moment. Yes, you're right - it should eventually be driven using disk io completion upcalls which triggers the push of data into the socket buffer. I totally agree. I'm hacking up some libevent-ish looking thing that uses kqueue and wraps aio, read, write, and other event types into something I can easily shoehorn this stuff into. I'll then throughly test it (and other options) out. You're right, it's likely going to end up with a whole lot of aio threads sitting there waiting for disk IO to complete - and at that point, I'll start hacking at sendfile() to split it into two halves and have it driven by a completion call from g_up or wherever, triggering the socket write side of things. There are some other questions too - like whether the IO completion should just queue socket IO (and have it potentially block in the TCP code) or whether it should funnel completions into a per-CPU aio completion thread which does the socket write bit. That way disk IO completion isn't going to be blocked by longer-held locks in the networking stack. Thanks, -adrian