Received: by 10.223.148.5 with SMTP id 5csp6284549wrq; Wed, 17 Jan 2018 11:44:23 -0800 (PST) X-Google-Smtp-Source: ACJfBottVWzhAT196DWGP0jr0xASbjJtsxS7aHIxT+d6hjQ2pTuXDEArWeU34AfbU0sBthKeOhVa X-Received: by 10.98.228.5 with SMTP id r5mr15437974pfh.193.1516218262764; Wed, 17 Jan 2018 11:44:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516218262; cv=none; d=google.com; s=arc-20160816; b=HDS89h6YSIuKEH6LsBJB5LdQaNR1bRtKeEauFUmQL+b2duoSQWJPLUgRv5c/Zg1OpU kjOTLqgrQN9lHseUstJIeDKGmi3aF/Cl9vznUpTp4VEOQxEssuJY2gJLf/wwiZ1/kupt 9UDeCEpFuh0v7qCBhKJ7eh/Y0jWb2WufUtYmvNyqHafMaKMfFpYpNWwnhw4O96XKVQ5f YCXIg6RJI87xlp1gRo2tbj/HHZTsec4IaUtL4yJcBqh163Eath8nRCAX+fovWRTAvmKb VEg1LOJEGxi6umCdyXOInYYYHSVzfGuciYlFc0RL7t4rvSLZiR6k5cNtjrEkuPGwrL0B gRug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=DImAwx0QTc1pCkjqJpk+BdMrixdbCsxADheU8cvvLzA=; b=M/914T+idwsdgqMBZlYdzBVS1CAWuosyTLrWRxW0oMU8gFcpDp/J4Vp/Wz7nc4ZK+c QYIPFmNkgzTHDcd6x8n2g1Nx1edPKeLiqQVkWpr6Yxgf9GWVNS6SljkpcK7XjNpktsZk 31BVGAPy1ZuE4kRdkMZyvbXRDYl2WO39eI7GBAcikFpo5IcFnz4JN7AInkYOvI7ZDb65 c+eF3/SnuXHoyaXVU0WvGbYk77PqdM1IT6g3RdxnX4TgcdHH3IcggiFVDSAVrTIHo0Un s2itJVxR90o0U81yU8dWXWJu8yWPh6aLSpeW3XUv4skauWXuz/qaZ+w3872yecjKWuGD bqVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rTua4LR0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s77si4942862pfj.128.2018.01.17.11.44.09; Wed, 17 Jan 2018 11:44:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rTua4LR0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752740AbeAQT1t (ORCPT + 99 others); Wed, 17 Jan 2018 14:27:49 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:57887 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbeAQT1r (ORCPT ); Wed, 17 Jan 2018 14:27:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DImAwx0QTc1pCkjqJpk+BdMrixdbCsxADheU8cvvLzA=; b=rTua4LR0L12Ze+BkP1E2s+jKA VuxWZCa3BuUCFp9lUQ8uT4x63bsatdJEMQaIfmwajns/gub+csHUiLIEZKqrTCowr0451O72lci3D R2hq+rc2G32Oyi4imr0zU78TwxrH5uwccafK1rNBKrnw+HY2pnP4oFaNrzi4nl+eJlWRawk/K2E6l O45SXEkeHthqdaMXEDjtzSgHf8HW7mdUTPffO5nDXxn+R/BQxgSt/7giVqYvhbwcjb+N6WU6G9bFu MaaWB3y/19zRGxDWnCFiSen/0Jx+sTTM1l+GtiNghgKR8UCQ80+a8zAnxcWlsxXcjNXBm8dyT88lw iVKAyvOfg==; Received: from 77.117.185.35.wireless.dyn.drei.com ([77.117.185.35] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ebtNB-0002xD-4Q; Wed, 17 Jan 2018 19:27:45 +0000 From: Christoph Hellwig To: viro@zeniv.linux.org.uk Cc: Avi Kivity , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: aio poll, io_pgetevents and a new in-kernel poll API V3 Date: Wed, 17 Jan 2018 20:27:06 +0100 Message-Id: <20180117192742.710-1-hch@lst.de> X-Mailer: git-send-email 2.14.2 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, this series adds support for the IOCB_CMD_POLL operation to poll for the readyness of file descriptors using the aio subsystem. The API is based on patches that existed in RHAS2.1 and RHEL3, which means it already is supported by libaio. To implement the poll support efficiently new methods to poll are introduced in struct file_operations: get_poll_head and poll_mask. The first one returns a wait_queue_head to wait on (lifetime is bound by the file), and the second does a non-blocking check for the POLL* events. This allows aio poll to work without any additional context switches, unlike epoll. To make the interface fully useful a new io_pgetevents system call is added, which atomically saves and restores the signal mask over the io_pgetevents system call. It it the logical equivalent to pselect and ppoll for io_pgetevents. The corresponding libaio changes for io_pgetevents support and documentation, as well as a test case will be posted in a separate series. The changes were sponsored by Scylladb, and improve performance of the seastar framework up to 10%, while also removing the need for a privileged SCHED_FIFO epoll listener thread. The patches are on top of Als __poll_t annoations, so I've also prepared a git branch on top of those here: git://git.infradead.org/users/hch/vfs.git aio-poll.3 Gitweb: http://git.infradead.org/users/hch/vfs.git/shortlog/refs/heads/aio-poll.3 Libaio changes: https://pagure.io/libaio.git io-poll Seastar changes (not updated for the new io_pgetevens ABI yet): https://github.com/avikivity/seastar/commits/aio Changes since V2: - removed a double initialization - new vfs_get_poll_head helper - document that ->get_poll_head can return NULL - call ->poll_mask before sleeping - various ACKs - add conversion of random to ->poll_mask - add conversion of af_alg to ->poll_mask - lacking ->poll_mask support now returns -EINVAL for IOCB_CMD_POLL - reshuffled the series so that prep patches and everything not requiring the new in-kernel poll API is in the beginning Changes since V1: - handle the NULL ->poll case in vfs_poll - dropped the file argument to the ->poll_mask socket operation - replace the ->pre_poll socket operation with ->get_poll_head as in the file operations