Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp864817lql; Mon, 11 Mar 2024 23:10:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXMqE7ew/D2YKE6sYU9dQ9VgHDB5L1aIRNblTGZ67d2uG5J4SZu3raSH6PrXuGQrzyRGvRL7mfWHF+cjVmJ/qBvgdS3xbKMkTFbWMvu1w== X-Google-Smtp-Source: AGHT+IHU//8EUC2z9HroXJJeX0ZubQM88JazSxWV3eFPN/fhPnXkNEGPJfoQtegJoYfwAtJ84SFd X-Received: by 2002:a50:8dc5:0:b0:566:1be1:688c with SMTP id s5-20020a508dc5000000b005661be1688cmr1741238edh.11.1710223851252; Mon, 11 Mar 2024 23:10:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710223851; cv=pass; d=google.com; s=arc-20160816; b=xlAL234KmYn+SO+zR4qxUG6koeiauwNMsCgJ+IvbOKLxFcPxdUqLO29ZhEsoiwKIFS lR7tj6iMOAhEh6IA/oMkQbGAzDY3mQRqFJgh62z5VscIIFVTRtXLdIuX2IReG56o2ICH u3+zrYFlM4A4HMENakQ0pIKvtVTwy1vVWEFze+IS28ktZ4nqyn9x9SdcohEDm+FyYc2e 8cbTT4tnQVCRXZmYV/V2Ut4r3MAsmp2cCZWtX6Ys0Gu1pTWFajZE5b1TcpZ6NK5aJDLX sIAHa+H1qA6lbHDPdUalaDr5TnT3G8g4Iei5To/vurbaP1IU2uhlKinXiOMJMIe4Evli n/zA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZUZJaWEEzxX+GNg6McoSX4YnqqxS5sF5DN1FsZZbsHc=; fh=g7iQRhe+Qg/1iI9SrCbGt48cwgaaDYy2zr/xiwCfWt4=; b=bh/umPT0Qn+aREe44Wf+KBR4Z9muxsUWydiVa3O3VUHRzwsX1MP6aFWSyl3xRLxcVn Q9r9ulXrlN2Hari8Ak3SzGDrXpWuiIwUJhuL0URJqoWq6WpJrHLdpT5f+eAN7Tm+daUS k1SbwM8fWh/5z+I0MZMgEfLnHEg3EOvrmwALjUoGVi74FSV/d5OZAm/oBHhRqwnykZ/s YV/2zEJ1lflGEy0RUzNu8EjTF0S2bHyqVOilHTIYY20kw3fse8WtE7UWevOvXrZTfIXx EdH51NTw+8XXBv4fRmdhW3BlSvXfbpnuDKTjK8Yz/R0cjQqKf81cCn+ohHaErV2e4FRu TBuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="kLvn/sNX"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99861-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h10-20020a056402280a00b0056829eefbfcsi3209158ede.14.2024.03.11.23.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 23:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99861-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="kLvn/sNX"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99861-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 009151F22430 for ; Tue, 12 Mar 2024 06:10:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0ABA7347C2; Tue, 12 Mar 2024 06:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kLvn/sNX" Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F01A2B2D7 for ; Tue, 12 Mar 2024 06:10:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710223844; cv=none; b=I66gWhKupu15H+HKjq1yVd/lV9bTklTIVgYXZ6/s7W69DPyYHTXnHci9hpMNIXS07CiMtAu3fszA+jkmouOIqKgeCI2Y50SNkPqI0E5ymAA6IRstbDRR+bipdz45WZ1PVtobu75i9o57wMcb15/O49A5Y6dBn9b31DLgNoN6dT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710223844; c=relaxed/simple; bh=ybFLnM3llydQ6uM4aNUokd81z0UHkzUojJ+qFgNSA7I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mTKsoSORk8lW9rfROuV13yIjPag1SYoVM1XXJsvVUWq+RSBjcd4fUBy/8T5h2kgz1YCW+rbLmibiUNJCHXNX6IxRLyuCWfjIC9y050CxgOWQ3kfNFHRSeyELhSJQtLaop+DYiLhSSpBLfyj8H1Vsa9DHQU/VpR4GyFzk3DTwVdo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kLvn/sNX; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-33e94c12cfaso1667607f8f.3 for ; Mon, 11 Mar 2024 23:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710223841; x=1710828641; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ZUZJaWEEzxX+GNg6McoSX4YnqqxS5sF5DN1FsZZbsHc=; b=kLvn/sNXYVmWqo512ANyBiLcjl92WNGy4Krm3uWBmH4SrpcF48Bif2VDwY+J9wEfSx Vf2ixCaZyxLRpmXwVujiOGFH0b6VMN/fd8NnS+ZSX4B1wHB3YlI/ivYNrfwvAkt5V0Zg 4kknmz/aHvI5LuOIf3WyuubNk8xAa7gBn1s8KxWF32YJymqqJ/kFhTBwH3IEfpAuje6s v3UvoF7Z+UxIZaanbW9QS5bHUMgABhp/Cq1hytG/8D8blygyOsAcRQDHw9e5O5Ul334S k5czx8Ev2mAqyTKfgU4djGOnWW9SmVwnXWya//9c03GIKri3igidujJMKBDQS03SXdJ1 FWIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710223841; x=1710828641; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZUZJaWEEzxX+GNg6McoSX4YnqqxS5sF5DN1FsZZbsHc=; b=Ah9SX5kcalUM4ovvWtfoD/QybW3z1TPsL6zHP2nX2OpGUO/qU3Ppe9lxl5P2VcEU6z 0defBYdAkbaYXecJi9vK9XZW0s4q5NOukGWyvWKlIxntWGQ/+HWXa+4zOI0Q3rCVlIw8 QT36A1Q51iaU0dm6EoPI8p9T+L5re7jj7kczL4I8che0zk5wLlA524+KRh1h/mSm84MG Nii/xwf0Dmer4MfT8uHBpZp3VonxRx/xC6NK1CpNymEORt5RhWxvCpTvYVfW2czF1E24 OLA+M5RGxT+x2wHNgdWyLwJZS8w9Wh8YEzGKslz3s9ddCojbU4FHbKbq6yqOurZsqQdQ UFag== X-Gm-Message-State: AOJu0YzS3qGGIGIWFq/kqx9q/tfyH5IQF50QenW4/ZgqYCtRoUwWHAfZ EOt63nsst5jLk8dkh2Aekwhx64MJaOXCx3/MufyyJnoid8B2CwD5 X-Received: by 2002:a05:6000:1866:b0:33e:818e:d05d with SMTP id d6-20020a056000186600b0033e818ed05dmr2362205wri.35.1710223840554; Mon, 11 Mar 2024 23:10:40 -0700 (PDT) Received: from Levi-MacBook-Pro.local (host86-137-203-168.range86-137.btcentralplus.com. [86.137.203.168]) by smtp.gmail.com with ESMTPSA id bq30-20020a5d5a1e000000b0033ea499c645sm973409wrb.4.2024.03.11.23.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 23:10:40 -0700 (PDT) Date: Tue, 12 Mar 2024 06:10:38 +0000 From: "levi.yun" To: hannes@cmpxchg.org, surenb@google.com, peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] psi: Fix avg trigger being fired unexpectedly. Message-ID: References: <20240226211237.48415-1-ppbuk5246@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240226211237.48415-1-ppbuk5246@gmail.com> Gentle ping.. On Mon, Feb 26, 2024 at 09:12:37PM +0000, Levi Yun wrote: > commit 915a087e4c473("psi: Fix trigger being fired unexpectedly at initial") > fixes unexpected event fired when group->total accumulated for PSI_POLL. > But, for PSI_AVGS, win->value should be initialized with group->total[PSI_AVGS]. > Moreover, to get exact initial value for win->value, it should be set > under each trigger lock to avoid concurrent changes to group->total[]. > > Signed-off-by: Levi Yun > Acked-by: Suren Baghdasaryan > --- > v2: Fix commit message. > --- > 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 7b4aa5809c0f..e7f66ab2ad3e 100644 > --- a/kernel/sched/psi.c > +++ b/kernel/sched/psi.c > @@ -1323,9 +1323,6 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf, > t->state = state; > t->threshold = threshold_us * NSEC_PER_USEC; > t->win.size = window_us * NSEC_PER_USEC; > - window_reset(&t->win, sched_clock(), > - group->total[PSI_POLL][t->state], 0); > - > t->event = 0; > t->last_event_time = 0; > t->of = of; > @@ -1336,6 +1333,8 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf, > > if (privileged) { > mutex_lock(&group->rtpoll_trigger_lock); > + window_reset(&t->win, sched_clock(), > + group->total[PSI_POLL][t->state], 0); > > if (!rcu_access_pointer(group->rtpoll_task)) { > struct task_struct *task; > @@ -1361,6 +1360,9 @@ struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf, > } else { > mutex_lock(&group->avgs_lock); > > + window_reset(&t->win, sched_clock(), > + group->total[PSI_AVGS][t->state], 0); > + > list_add(&t->node, &group->avg_triggers); > group->avg_nr_triggers[t->state]++; > > -- > 2.39.2