Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3156890ybi; Mon, 29 Jul 2019 01:54:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/ILmzMd2I/DKTZrn+jJpEIrAIKU+YLaR1HoPof0hN5ofzirwvfUvWbbSuuCHkiRiFOCvm X-Received: by 2002:a17:902:4623:: with SMTP id o32mr107123514pld.112.1564390456110; Mon, 29 Jul 2019 01:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564390456; cv=none; d=google.com; s=arc-20160816; b=BKQKITiy61zD5ocQjcupH1WMEGTa7bDeIv9oE8ZhUrHGsispK6jdQNJgeNWOVcLnJp +86g9lcF6ZhoAlWDJhbHGkPuoA7uA9VdxGDYkDM0CH+z1OEU+j8AllkO+oFtsz5idV9A XTUIbV1FX7e8flS9btlf/H6cMBPz4Zdb0KOoeI7FuBZcRAU7dYW3NgUqRhMETKKBjOho AgLYhsd7rXtrP24uOQbEvLkAh7cmTtcUxKL5tD+/MjtqB2F0Ht6lpF6dnVm8pdStV32X 3/YfcHgW3nZ3YCWGl6U7o190zEX9zVkt5F6PEx4DV6t7Rqx663H5qak5LjQ5C+epL9+h kNdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=rIIuKcnQ1kgGy3ApNU5gtiozgjxr7A3E164hdY1Lb8U=; b=v631ocuBM44/BrmX/pz0hDq8ya5Q/6edoVtwdslIRcxBb9w/AqzXAajBuQFN4kF8WQ F2bpnIQ1OP+8vwmA3o/MdE4lR4XJmQGNtixsFXkNZarzsLdYTwlUO8vKLKyz0nd+CXua 3TD7+iK2hZKvp+keXOOLZyz50al7vKdpTJMPWAkHkhI/VlgLOmEUiJyrWA9ijDZZpaY8 usgpdjyLEKYCS6zKJo8KIbArj177Zfpr0KoLG2FAjxmdgNWbSeTjmHc/K5RNHMLaORdE KMVglKI63lr2ABQXBvnIyaZv3DjuGmJ5TUQf0TKq0eqhGSLdX+fhtgSjQdSLseE8LVLx BgHA== 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 o19si12911252pgv.497.2019.07.29.01.54.00; Mon, 29 Jul 2019 01:54:16 -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 S1727477AbfG2INK (ORCPT + 99 others); Mon, 29 Jul 2019 04:13:10 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:34916 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbfG2INJ (ORCPT ); Mon, 29 Jul 2019 04:13:09 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=kerneljasonxing@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0TY1HZl2_1564387964; Received: from ali-6c96cfdd2b5d.local(mailfrom:kerneljasonxing@linux.alibaba.com fp:SMTPD_---0TY1HZl2_1564387964) by smtp.aliyun-inc.com(127.0.0.1); Mon, 29 Jul 2019 16:13:03 +0800 Subject: Re: [PATCH] psi: get poll_work to run when calling poll syscall next time 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, linux-kernel@vger.kernel.org References: <1563864339-2621-1-git-send-email-kerneljasonxing@linux.alibaba.com> From: Jason Xing Message-ID: <4d7ca842-3246-10ee-9ae2-973d1b88ed93@linux.alibaba.com> Date: Mon, 29 Jul 2019 16:12:44 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1563864339-2621-1-git-send-email-kerneljasonxing@linux.alibaba.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Could someone take a quick look at this patch? It's not complicated at all, just one line added into PSI which can make the poll() run in the right way. Thanks, Jason On 2019/7/23 下午2:45, Jason Xing wrote: > 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); > } >