Received: by 10.223.176.46 with SMTP id f43csp3344254wra; Mon, 22 Jan 2018 12:29:48 -0800 (PST) X-Google-Smtp-Source: AH8x225UjbZ9BGcHk3t2PN0S+bQWvyuvaMAAeJniCwMt+4bBod7rPi54iN8b5dA4WYpBW2ZDarH3 X-Received: by 10.107.137.157 with SMTP id t29mr182726ioi.230.1516652988315; Mon, 22 Jan 2018 12:29:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516652988; cv=none; d=google.com; s=arc-20160816; b=UZCgfX1hQKslwwWK6lbrE7rD6lh4TU4eWhr5elQbHahiidXGj41Oi6kUtfQgmxo+iS JKskkrgXVpi+97+67SWeaqY+GOAEtjYrkkxV2EU6M9Bls45oc3M6xwapJUb+cnzBaiTx 1xezp2LG7DY1LLJOf3Bww9JHJGquzeiYmJZ6OnUYBmeleV9kVYp7qUKmY/vFvD3tjydM xCtfG7ohdKOmyneiR8pDrlFMRxYqnpo6k6tgnjqNcSHBwdbykxPCA7SJZtGBnwOdYaeY KNqCRvK5/1syHCWm48iixi6QD3D1r/qoLKKLwoQvjCcDcWW7SiIUmM4cwuqiABUp79QE qk7A== 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=YOKl6HOZMk5p2Aj7q/nsc8MvYiwzlif0MH69gJiyMtM=; b=ZmrmZOUVyvHrvVsHAaAh+SWI0MdalIJkpbdj4EM3kLh52tGCG/2FznnefESMS6A0wl 5MAmZTj/wbJehAqpzLA9N87wfsZLqK+H9xyeYOjgMkUQXP0nroYYmgT2lgU/pIIfUlOc UamxVpqF2aTXPdq1+LwYi7mMRhcXznK22a6Hi8L6Alust9m8fIlOPudb3Y17ySkTXmkE +z3jobKfsJsbr5/AU0ulcHXAcofe5G4EU/oKVt7s+2MEtfC/8JFSetofHUFpeDykFtV4 mC2aTFxSF/T3xl8Pq152p/0J2qLIW3SzqZycwvKwn14WhJNVf3uUAoxKxbJqS+JXVHqW H5qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QcfcYZz1; 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 q67si6896170itg.57.2018.01.22.12.29.35; Mon, 22 Jan 2018 12:29:48 -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=QcfcYZz1; 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 S1751147AbeAVUM7 (ORCPT + 99 others); Mon, 22 Jan 2018 15:12:59 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:39867 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751254AbeAVUMy (ORCPT ); Mon, 22 Jan 2018 15:12:54 -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=YOKl6HOZMk5p2Aj7q/nsc8MvYiwzlif0MH69gJiyMtM=; b=QcfcYZz1m3xGPtlVXQX9YyUmu HwuMh0quqaebtEU+MWRSvFmMyk120r0kFDQrFVgkam/icVKgkykRthMjpYPRTsVctupBZmyh+wcrS 55HmAVUomA3LdtRiuYgI/XKbPeqQWjvwkcOGdfU1xYtbwyIsLVLA4vWt9iTeu1aYZCdscUVEc9oeJ Arb+27sySmR5W4CExmk2BFxHtMcYLk32nZgtmoAHMqD4jwu6MvtqTkTa3fpPfXvKiXal3XuwRksSK Mlhc+1nH0RE6ljmTCpEA9MxKiFdCJ3Sv3lT6PH2GvtXML8G1wGpcVFVyMATrzwMJuTuep7EFYbDLU n3fAybIxg==; Received: from 178.114.226.247.wireless.dyn.drei.com ([178.114.226.247] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ediSU-0007U4-PK; Mon, 22 Jan 2018 20:12:47 +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 V4 Date: Mon, 22 Jan 2018 21:12:07 +0100 Message-Id: <20180122201243.31610-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.4 Gitweb: http://git.infradead.org/users/hch/vfs.git/shortlog/refs/heads/aio-poll.4 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 V3: - remove the pre-sleep ->poll_mask call in vfs_poll, allow ->get_poll_head to return POLL* values. 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