From: Jason Xing <kerneljasonxing@linux.alibaba.com>
To: hannes@cmpxchg.org, surenb@google.com, mingo@redhat.com,
peterz@infradead.org
Cc: dennis@kernel.org, axboe@kernel.dk, lizefan@huawei.com,
tj@kernel.org, kerneljasonxing@linux.alibaba.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] psi: get poll_work to run when calling poll syscall next time
Date: Tue, 23 Jul 2019 14:45:39 +0800 [thread overview]
Message-ID: <1563864339-2621-1-git-send-email-kerneljasonxing@linux.alibaba.com> (raw)
Only when calling the poll syscall the first time can user
receive POLLPRI correctly. After that, user always fails to
acquire the event signal.
Reproduce case:
1. Get the monitor code in Documentation/accounting/psi.txt
2. Run it, and wait for the event triggered.
3. Kill and restart the process.
If the user doesn't kill the monitor process, it seems the
poll_work works fine. After killing and restarting the monitor,
the poll_work in kernel will never run again due to the wrong
value of poll_scheduled. Therefore, we should reset the value
as group_init() does after the last trigger is destroyed.
Signed-off-by: Jason Xing <kerneljasonxing@linux.alibaba.com>
---
kernel/sched/psi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 7acc632..66f4385 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1133,6 +1133,12 @@ static void psi_trigger_destroy(struct kref *ref)
if (kworker_to_destroy) {
kthread_cancel_delayed_work_sync(&group->poll_work);
kthread_destroy_worker(kworker_to_destroy);
+ /*
+ * The poll_work should have the chance to be put into the
+ * kthread queue when calling poll syscall next time. So
+ * reset poll_scheduled to zero as group_init() does
+ */
+ atomic_set(&group->poll_scheduled, 0);
}
kfree(t);
}
--
1.8.3.1
next reply other threads:[~2019-07-23 6:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 6:45 Jason Xing [this message]
2019-07-23 10:02 ` [PATCH] psi: get poll_work to run when calling poll syscall next time Caspar Zhang
2019-07-29 8:12 ` Jason Xing
2019-07-29 15:29 ` Johannes Weiner
2019-07-29 16:27 ` Suren Baghdasaryan
2019-07-30 5:16 ` [PATCH v2] " Jason Xing
2019-08-02 6:20 ` Jason Xing
2019-08-15 1:59 ` Jason Xing
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=1563864339-2621-1-git-send-email-kerneljasonxing@linux.alibaba.com \
--to=kerneljasonxing@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=dennis@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=surenb@google.com \
--cc=tj@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.