Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8479466ybi; Tue, 23 Jul 2019 09:16:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWkag6MxHgYvi9LkiGvcNETQFfIK0W53AlJb/8WraSt0pHtmwBz+1XS5tzWad/XDFHpVQA X-Received: by 2002:a63:5550:: with SMTP id f16mr59969398pgm.426.1563898604037; Tue, 23 Jul 2019 09:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563898604; cv=none; d=google.com; s=arc-20160816; b=ynhqNOJgo5qtLXzik+NJoNV7PKEHRgdj2mKzHV5T/tZ07yk0k0yU7bj9EpOWJFo6GA 0c4fvSJq9UQQXGqDKw4AyUO3Iz6iinEkKpQWVL0VhE/84H49eiWEmEBOb/CZkcRV04Ye h6bhAlVoksU1XdmcPEpQa737euLyhLb2W6jbeNSOcBQbGHJuhMqTFWqJbJvjBZcPcWK1 b5I6tnWinUChIh8yRgxc0bLz6BP9YWq1KFDw7oF3cC4rFJnzHsp/Uas4e2pdnASvt6wI GgTTQMcehcJlK/rvdR0okrBtUMDRflSz5I/JDOfR5utS2Noji8+p+BlmwRVKNavslrGA roTg== 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; bh=rPoVVlfSubtXrIvOyjS9J5x8b4/M0ZRi9i57Y3R+uqU=; b=DUuVlS3PrMeYKcoL6oBN5stUNUeN5l6/+hT00deMXOVGPSD2bzDDD7WhkDcSPNel/j EgKGyTJs7SbLykYY+SJETMH1RqjGKacRysiMY7ukscW4jW3FgEkgyNc+8ieBudDgDxGf GKNI/QQw3+5cJHJnuyYPZ/v8SLcSMam6lCnBRhwDckww1Vs6ozl0qy5guiZx3yz2a57i k+Yf5lZQ+w0ETgoyQUeZo/wB5/SMKlrrlbod3eHea3DY0UTsSldSD9ocx6vHAFZy0CsO picHo398XS+vz7ntZ61DokuAkbrEYqHNNROaRlE00GwtIDI9Fm7SRHxE1sh0kmipgi3T Szdg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si11854933pln.285.2019.07.23.09.16.27; Tue, 23 Jul 2019 09:16:44 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388169AbfGWGp5 (ORCPT + 99 others); Tue, 23 Jul 2019 02:45:57 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:46436 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732590AbfGWGp4 (ORCPT ); Tue, 23 Jul 2019 02:45:56 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R621e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07417;MF=kerneljasonxing@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0TXbisZS_1563864339; Received: from localhost(mailfrom:kerneljasonxing@linux.alibaba.com fp:SMTPD_---0TXbisZS_1563864339) by smtp.aliyun-inc.com(127.0.0.1); Tue, 23 Jul 2019 14:45:54 +0800 From: Jason Xing 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 Message-Id: <1563864339-2621-1-git-send-email-kerneljasonxing@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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