linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Imran Khan <imran.f.khan@oracle.com>
To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH] eventpoll: record task that adds to monitor list.
Date: Fri,  8 Mar 2024 15:21:36 +1100	[thread overview]
Message-ID: <20240308042136.2739321-1-imran.f.khan@oracle.com> (raw)

While debugging latency issues for task waiting on epoll_wait, sometimes
it becomes necessary to see if the lower layer is invoking ep_poll_callback
timely for a given pid or not.

Recording task_struct in involved eppoll_entry's wait_queue_entry, allows us
to check this using a probe (say dtrace) at this function.
We could also achieve this by checking wait_queue_entry on eventpoll's
wait_queue_head itself, but that would involve more indirections.

Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
---

Since it just helps in debugging, I have kept the patch RFC.

 fs/eventpoll.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3534d36a1474..3d4faf0a2d25 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1287,6 +1287,8 @@ static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead,
 	init_waitqueue_func_entry(&pwq->wait, ep_poll_callback);
 	pwq->whead = whead;
 	pwq->base = epi;
+	pwq->wait.private = current;
+
 	if (epi->event.events & EPOLLEXCLUSIVE)
 		add_wait_queue_exclusive(whead, &pwq->wait);
 	else
-- 
2.34.1


                 reply	other threads:[~2024-03-08  4:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240308042136.2739321-1-imran.f.khan@oracle.com \
    --to=imran.f.khan@oracle.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.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).