From nobody Fri Apr 3 00:50:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB32DC54EE9 for ; Mon, 19 Sep 2022 07:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbiISHYD (ORCPT ); Mon, 19 Sep 2022 03:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiISHYA (ORCPT ); Mon, 19 Sep 2022 03:24:00 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56161A83E for ; Mon, 19 Sep 2022 00:23:59 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-11e9a7135easo60713957fac.6 for ; Mon, 19 Sep 2022 00:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date; bh=sCiPjQA8piKqpO36PIwKnu4u/TUaVUoG8iasiR3UyYg=; b=FZ0UP0kVQBddy5BvvXz/0bbGguGduK7ReCFhhPrly+/Tr+wl/w8ABX6rJ59mqJIdp1 3hLfh9qVzQZVAO9UHVBDq+C9sjaRVbHMtbe8FrmlqUYQEX/IopnJBE2Din+Ygs4ko+9W yPZmG2PIoQ5ecKKgP1h0dqOnYrQy7Ch1heFSZkq90uyWMdnK5csZbcIO4OO0Rfy7GSXg JJYlYNMdOe7qEQJinvCx78ubuPPeoV7rIgjxrW0qbiouPrNzY2lLRekg+L0jlnjBD1/v d4b/qHGOb5+4XIA0RUB1psmV3LfdnhFaJ7y2TmqWJJ4Vw02OZQw7nH+UqahELHcHLhZE 6/nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=sCiPjQA8piKqpO36PIwKnu4u/TUaVUoG8iasiR3UyYg=; b=y+J1fiZrQnkZy3JVfpU3aycpKnZyrPLJS+hOhu7BIMQ7EpJu4mbpDCqvET9DatXmtn tL3h5YAfp4boPvSy2DmjzGuCoznrfoiqPnxt2h+oqJkUPlK7lAE01dENc0zO/mYbFFev nwHQPQEgjN+yQX3PFBsx3Qo4Cdf+YHAuKIQ5+JGWvMDUqQOI9BkG9mKSP8f0xOgZY6W9 050XDwfK2vPVnqMZv9c5xr2vnTCBptfhYAQJG3rE1Lnwy1bcGAOdG2gNC4lX2MRajfob ym06pxpCet8bR6QP3XFTe2EqjRXYj0NgiRLoDmGxuG8IHRCb8XmWnsRT+JxQJ2dLJ4kC q5Uw== X-Gm-Message-State: ACgBeo0eATbMUtzmwGQCem10BGYFcMrGGEpNpeWKHkmlJbFLO7GRJWek 9Fz1jLKzSWtxqCm9wavlL0U= X-Google-Smtp-Source: AA6agR7bsHoK8O8o+qYLGqJhcg9CxAHfP7w+25hqrijqTl6F8de0QmGpWkd1yEib2fhGsWgd53+Fdg== X-Received: by 2002:a05:6870:c38f:b0:12b:cb22:9056 with SMTP id g15-20020a056870c38f00b0012bcb229056mr15542798oao.125.1663572238301; Mon, 19 Sep 2022 00:23:58 -0700 (PDT) Received: from haolee.io ([2600:3c00::f03c:91ff:fe02:b162]) by smtp.gmail.com with ESMTPSA id x30-20020a056870331e00b00127a91041a9sm7202871oae.38.2022.09.19.00.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 00:23:57 -0700 (PDT) Date: Mon, 19 Sep 2022 07:23:56 +0000 From: Hao Lee To: hannes@cmpxchg.org, surenb@google.com Cc: peterz@infradead.org, zhaoyang.huang@unisoc.com, haolee.swjtu@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v2] psi: fix possible missing or delayed pending event Message-ID: <20220919072356.GA29069@haolee.io> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.12.1 (2019-06-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When a pending event exists and growth is less than the threshold, the current logic is to skip this trigger without generating event. However, from e6df4ead85d9 ("psi: fix possible trigger missing in the window"), our purpose is to generate event as long as pending event exists and the rate meets the limit, no matter what growth is. This patch handles this case properly. Fixes: e6df4ead85d9 ("psi: fix possible trigger missing in the window") Signed-off-by: Hao Lee Acked-by: Suren Baghdasaryan --- kernel/sched/psi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 9711827e3..7d305d0e0 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -539,10 +539,12 @@ static u64 update_triggers(struct psi_group *group, u= 64 now) =20 /* Calculate growth since last update */ growth =3D window_update(&t->win, now, total[t->state]); - if (growth < t->threshold) - continue; + if (!t->pending_event) { + if (growth < t->threshold) + continue; =20 - t->pending_event =3D true; + t->pending_event =3D true; + } } /* Limit event signaling to once per window */ if (now < t->last_event_time + t->win.size) --=20 2.21.0