From patchwork Tue Sep 5 21:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13375094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50B1BCA1008 for ; Tue, 5 Sep 2023 21:42:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F2518E000C; Tue, 5 Sep 2023 17:42:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02AF58E000B; Tue, 5 Sep 2023 17:42:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE7A68E000C; Tue, 5 Sep 2023 17:42:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D16618E000B for ; Tue, 5 Sep 2023 17:42:45 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A0103120AC5 for ; Tue, 5 Sep 2023 21:42:45 +0000 (UTC) X-FDA: 81203868690.21.B3CC7EC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf23.hostedemail.com (Postfix) with ESMTP id E090614001E for ; Tue, 5 Sep 2023 21:42:42 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FnIpWh2+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693950162; a=rsa-sha256; cv=none; b=78Os8T9DJOA4SvqXngV2NZ1JUK91/1nYV6aA8s+gH8YmmcvxZDUepBwdm7V7wmRJR+kwjD 1Szyf/hLKDgUtROO7vO2r+NTSf2AQas4Ub4Cxo1i6VXsdt484tpPPHxWo8Js1uuk6HiDMx iSP+MOyUMLPEQWojrsM4ozguQgglHNY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FnIpWh2+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693950162; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iFjFRpr2tLumBDFqT/D9Qiro5EdrVpMUq8hDA8RT3eI=; b=wdY40VeO+PTnSASsWEsFzOuafRrwXwZ+tSIuro2RCBsvqxL9+PHCpSzvBVe9OPsdc43Zv+ MrcdF9iG4wXZ36uhDAF7tENSP3YcVKd17zT3OcXD7CnSE6sXbEETrKcb1MfCP6Ve6EZyNP YOYt82ujjz/GNu4LY5OLjU4Jko26u/A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693950162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iFjFRpr2tLumBDFqT/D9Qiro5EdrVpMUq8hDA8RT3eI=; b=FnIpWh2+3dEgghJAUd7IzNsGWC9/+r+PpT3uoY23yk+g85h0vDQx0fUol0FJoyVSe6wTL+ z16b9KvrSw7RMWlDjfTH23X84Un7Qb9ulJxxdL4QB1ladqy+caO55iNuPJ80Cx6HLuPPDH rZTRr/LbEqwxDzMheC+9FSOATF0rLIg= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-O2-Wz8zQNbmF8AXMMhDqDA-1; Tue, 05 Sep 2023 17:42:41 -0400 X-MC-Unique: O2-Wz8zQNbmF8AXMMhDqDA-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-76efdcb7be4so82010085a.1 for ; Tue, 05 Sep 2023 14:42:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693950160; x=1694554960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iFjFRpr2tLumBDFqT/D9Qiro5EdrVpMUq8hDA8RT3eI=; b=UMVrEZV0pp8b9ZDseHFTcs5s0oGOrBpzzHxEhc4TBL7A9Xb4ZdQ12AjUYP3PXt0+nf GMX6j21/53KLETG3v9r+Kc83eDWHU2u5WIWXMEnvKMxdMaVnWfa+GTujlty3LcSIuZ72 K99xjUDEykPJ6ID0RKc6jXIyHcuy8vSn9q3d1jw/k8CSQHaTkwMjxi0kPjP0IOBlXSHD Fu89/0t/TbFkMfpd36NwraG01sKTDBn6eW7SdC586YaG/IEim5Pod4b1uNPCnKWjWhFY llJV60HngJUrt2cenLnRkhW3cHPDsNEu8+ZXju7CxxwxZxTr1Dv6KSdML9GIRQdxC+vs tw0g== X-Gm-Message-State: AOJu0YyfPtsEuUX0Re19nX3J3i4HwxMz+ZJdXTkSfDy5GUUeqkYwwtTU bgRbxLsaQrQ/vqXrowgykYPASBTi/2O9n+9sk76tKqM9nafwzQyBJXrYTrGaLfxcpXLqHnEOyrd 19OE3E96tyCs= X-Received: by 2002:a05:620a:1a92:b0:76c:ea67:38e2 with SMTP id bl18-20020a05620a1a9200b0076cea6738e2mr16297936qkb.2.1693950160427; Tue, 05 Sep 2023 14:42:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGb0/uwjCE+wD8vjFeylTm+w9KR1ry9a3YxdBWKPhIRxUJR2OeC5hjEf8cXax4t1I0LDP54fg== X-Received: by 2002:a05:620a:1a92:b0:76c:ea67:38e2 with SMTP id bl18-20020a05620a1a9200b0076cea6738e2mr16297913qkb.2.1693950160176; Tue, 05 Sep 2023 14:42:40 -0700 (PDT) Received: from x1n.redhat.com (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id i2-20020a37c202000000b007682af2c8aasm4396938qkm.126.2023.09.05.14.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 14:42:39 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Anish Moorthy , Axel Rasmussen , Alexander Viro , Mike Kravetz , Peter Zijlstra , Andrew Morton , Mike Rapoport , Christian Brauner , peterx@redhat.com, linux-fsdevel@vger.kernel.org, Andrea Arcangeli , Ingo Molnar , James Houghton , Nadav Amit Subject: [PATCH 2/7] poll: Add a poll_flags for poll_queue_proc() Date: Tue, 5 Sep 2023 17:42:30 -0400 Message-ID: <20230905214235.320571-3-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230905214235.320571-1-peterx@redhat.com> References: <20230905214235.320571-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E090614001E X-Stat-Signature: krg9ibzy1uhe5ti46q5me41uu6eym94p X-HE-Tag: 1693950162-215662 X-HE-Meta: U2FsdGVkX1+vJb5F+kXWCbIaY1e23mwbj8tGPXdg0m32l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I0cOQUVifhAvn3Y9N2pSGmEO0ox+Mp7PKgQqww5qqdaDexUDYJg/2wbOIC9AW0LAi2Wef3yHbsIYny/LJo04O1JE+VsWRLhEEwNWN1XWbjWYd9Btmyv0VSSJ/RuCv7afShPVhY39yHYdLpyJCGWktvJ/+KGRVdUi2d+K8BGtDT8iK1BWIhAUx7zTQB3O+SAbMQ4llnX/jOCzk7Re0BOo8bgsLx+iiF7dy8gmQE+2Hm4Q2bSDnxj32dSWqfSv7HqFSIAC8X8uIpiE5Mvgy+HC73S3ojsChO4uFBTuYM4fwwFErf+sGAVX5IuFViTIcJVkXPrqAamLq/x7hoEp839vIXGr90Ni6CW6cXS7q3w9fIcPlVRwtnD4Y/ChbrwjPb6K X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Allows the poll enqueue function to pass over a flag into it. Signed-off-by: Peter Xu Signed-off-by: Peter Xu --- drivers/vfio/virqfd.c | 4 ++-- drivers/vhost/vhost.c | 2 +- drivers/virt/acrn/irqfd.c | 2 +- fs/aio.c | 2 +- fs/eventpoll.c | 2 +- fs/select.c | 4 ++-- include/linux/poll.h | 7 +++++-- io_uring/poll.c | 4 ++-- mm/memcontrol.c | 4 +++- net/9p/trans_fd.c | 3 ++- virt/kvm/eventfd.c | 2 +- 11 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/vfio/virqfd.c b/drivers/vfio/virqfd.c index 29c564b7a6e1..4b817a6f4f72 100644 --- a/drivers/vfio/virqfd.c +++ b/drivers/vfio/virqfd.c @@ -75,8 +75,8 @@ static int virqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void return 0; } -static void virqfd_ptable_queue_proc(struct file *file, - wait_queue_head_t *wqh, poll_table *pt) +static void virqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh, + poll_table *pt, poll_flags flags) { struct virqfd *virqfd = container_of(pt, struct virqfd, pt); add_wait_queue(wqh, &virqfd->wait); diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c71d573f1c94..02caad721843 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -162,7 +162,7 @@ static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh, } static int vhost_poll_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, - void *key) + void *key, poll_flags flags) { struct vhost_poll *poll = container_of(wait, struct vhost_poll, wait); struct vhost_work *work = &poll->work; diff --git a/drivers/virt/acrn/irqfd.c b/drivers/virt/acrn/irqfd.c index d4ad211dce7a..9b79e4e76e49 100644 --- a/drivers/virt/acrn/irqfd.c +++ b/drivers/virt/acrn/irqfd.c @@ -94,7 +94,7 @@ static int hsm_irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, } static void hsm_irqfd_poll_func(struct file *file, wait_queue_head_t *wqh, - poll_table *pt) + poll_table *pt, poll_flags flags) { struct hsm_irqfd *irqfd; diff --git a/fs/aio.c b/fs/aio.c index a4c2a6bac72c..abb5b22f4fdf 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1823,7 +1823,7 @@ struct aio_poll_table { static void aio_poll_queue_proc(struct file *file, struct wait_queue_head *head, - struct poll_table_struct *p) + struct poll_table_struct *p, poll_flags flags) { struct aio_poll_table *pt = container_of(p, struct aio_poll_table, pt); diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 1d9a71a0c4c1..c74d6a083fd1 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1270,7 +1270,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v * target file wakeup lists. */ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead, - poll_table *pt) + poll_table *pt, poll_flags flags) { struct ep_pqueue *epq = container_of(pt, struct ep_pqueue, pt); struct epitem *epi = epq->epi; diff --git a/fs/select.c b/fs/select.c index 0ee55af1a55c..0433448481e9 100644 --- a/fs/select.c +++ b/fs/select.c @@ -117,7 +117,7 @@ struct poll_table_page { * poll table. */ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, - poll_table *p); + poll_table *p, poll_flags flags); void poll_initwait(struct poll_wqueues *pwq) { @@ -220,7 +220,7 @@ static int pollwake(wait_queue_entry_t *wait, unsigned mode, int sync, void *key /* Add a new entry */ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, - poll_table *p) + poll_table *p, poll_flags flags) { struct poll_wqueues *pwq = container_of(p, struct poll_wqueues, pt); struct poll_table_entry *entry = poll_get_entry(pwq); diff --git a/include/linux/poll.h b/include/linux/poll.h index a9e0e1c2d1f2..cbad520fc65c 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -27,12 +27,15 @@ #define DEFAULT_POLLMASK (EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM) +typedef unsigned int poll_flags; + struct poll_table_struct; /* * structures and helpers for f_op->poll implementations */ -typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); +typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, + struct poll_table_struct *, poll_flags); /* * Do not touch the structure directly, use the access functions @@ -46,7 +49,7 @@ typedef struct poll_table_struct { static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) { if (p && p->_qproc && wait_address) - p->_qproc(filp, wait_address, p); + p->_qproc(filp, wait_address, p, 0); } /* diff --git a/io_uring/poll.c b/io_uring/poll.c index 4c360ba8793a..c3b41e963a8d 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -533,7 +533,7 @@ static void __io_queue_proc(struct io_poll *poll, struct io_poll_table *pt, } static void io_poll_queue_proc(struct file *file, struct wait_queue_head *head, - struct poll_table_struct *p) + struct poll_table_struct *p, poll_flags flags) { struct io_poll_table *pt = container_of(p, struct io_poll_table, pt); struct io_poll *poll = io_kiocb_to_cmd(pt->req, struct io_poll); @@ -644,7 +644,7 @@ static int __io_arm_poll_handler(struct io_kiocb *req, } static void io_async_queue_proc(struct file *file, struct wait_queue_head *head, - struct poll_table_struct *p) + struct poll_table_struct *p, poll_flags flags) { struct io_poll_table *pt = container_of(p, struct io_poll_table, pt); struct async_poll *apoll = pt->req->apoll; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ecc07b47e813..97b03ab30d5e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4877,7 +4877,9 @@ static int memcg_event_wake(wait_queue_entry_t *wait, unsigned mode, } static void memcg_event_ptable_queue_proc(struct file *file, - wait_queue_head_t *wqh, poll_table *pt) + wait_queue_head_t *wqh, + poll_table *pt, + poll_flags flags) { struct mem_cgroup_event *event = container_of(pt, struct mem_cgroup_event, pt); diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index c4015f30f9fa..91f9f474ab01 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -550,7 +550,8 @@ static int p9_pollwake(wait_queue_entry_t *wait, unsigned int mode, int sync, vo */ static void -p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p) +p9_pollwait(struct file *filp, wait_queue_head_t *wait_address, poll_table *p, + poll_flags flags) { struct p9_conn *m = container_of(p, struct p9_conn, pt); struct p9_poll_wait *pwait = NULL; diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 89912a17f5d5..645b5d155386 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -246,7 +246,7 @@ irqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) static void irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh, - poll_table *pt) + poll_table *pt, poll_flags flags) { struct kvm_kernel_irqfd *irqfd = container_of(pt, struct kvm_kernel_irqfd, pt);