From: Peter Xu <peterx@redhat.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Anish Moorthy <amoorthy@google.com>,
Axel Rasmussen <axelrasmussen@google.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Mike Kravetz <mike.kravetz@oracle.com>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>,
Christian Brauner <brauner@kernel.org>,
peterx@redhat.com, linux-fsdevel@vger.kernel.org,
Andrea Arcangeli <aarcange@redhat.com>,
Ingo Molnar <mingo@redhat.com>,
James Houghton <jthoughton@google.com>,
Nadav Amit <nadav.amit@gmail.com>
Subject: [PATCH 2/7] poll: Add a poll_flags for poll_queue_proc()
Date: Tue, 5 Sep 2023 17:42:30 -0400 [thread overview]
Message-ID: <20230905214235.320571-3-peterx@redhat.com> (raw)
In-Reply-To: <20230905214235.320571-1-peterx@redhat.com>
Allows the poll enqueue function to pass over a flag into it.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
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);
--
2.41.0
next prev parent reply other threads:[~2023-09-05 21:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 21:42 [PATCH 0/7] mm/userfaultfd/poll: Scale userfaultfd wakeups Peter Xu
2023-09-05 21:42 ` [PATCH 1/7] mm/userfaultfd: Make uffd read() wait event exclusive Peter Xu
2023-09-05 21:42 ` Peter Xu [this message]
2023-09-05 23:21 ` [PATCH 2/7] poll: Add a poll_flags for poll_queue_proc() kernel test robot
2023-09-06 17:31 ` kernel test robot
2023-09-06 20:53 ` kernel test robot
2023-09-11 20:00 ` Peter Xu
2023-09-05 21:42 ` [PATCH 3/7] poll: POLL_ENQUEUE_EXCLUSIVE Peter Xu
2023-09-05 21:42 ` [PATCH 4/7] fs/userfaultfd: Use exclusive waitqueue for poll() Peter Xu
2023-09-05 21:42 ` [PATCH 5/7] selftests/mm: Replace uffd_read_mutex with a semaphore Peter Xu
2023-09-05 21:42 ` [PATCH 6/7] selftests/mm: Create uffd_fault_thread_create|join() Peter Xu
2023-09-05 21:42 ` [PATCH 7/7] selftests/mm: uffd perf test Peter Xu
2023-09-07 19:18 ` [PATCH 0/7] mm/userfaultfd/poll: Scale userfaultfd wakeups Axel Rasmussen
2023-09-08 22:01 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230905214235.320571-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=amoorthy@google.com \
--cc=axelrasmussen@google.com \
--cc=brauner@kernel.org \
--cc=jthoughton@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=mingo@redhat.com \
--cc=nadav.amit@gmail.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).