Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp255690rdb; Thu, 21 Dec 2023 08:17:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmE5Npprmlwc637cUxQEAM76fOsK77XJ4H9FWv09GgZbVZhnPxsrEKktsv1Jnp0+JwYlC1 X-Received: by 2002:a2e:9192:0:b0:2cc:9981:2abf with SMTP id f18-20020a2e9192000000b002cc99812abfmr835481ljg.7.1703175424478; Thu, 21 Dec 2023 08:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703175424; cv=none; d=google.com; s=arc-20160816; b=R8UkMY1Ui98AKmY0yfpJX8CqOoSpWmnkOrqW24ttp8MgdjYBAuxA0cLn4+HaIk8xRR 9IS+kkEJlxSq6AaQywBpeAyMsOsumBWhQZ271xiiyfQSGwgs7LTsC4cRe248jLMSareu bMn/qJqL5tJFzTmqlZSOn7WTWc12weou68N+IdAHwnUwqaNYcmHXKihG+uNgDickbfwd 81dIhroVdE4B1WbeUt2/sBFwITfOq6IpC8MuTAbRhpiho/qgoW9qaSWglUUH9mP5z69z ZWvV3fQ0+B5jzDL+Xp6fy7Mf6mqXRxKnWY0CTsx9gnmhWoEvLaXNsMIASALsL5TtJKlW AIOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=JNDwzkyVbVWHRlDqAlVAzcdYLL04NDJIY3AGS0xxeec=; fh=l83Qd/Hao8IHqfNYwnLRy/m+/UdAPH+5PqS+1Us5X5M=; b=HH0FvuDmOA/wmSRhjosgfbzaZ6BiSvm1y25ANNTbjeyDFBAy8ix68TAOiq+QC5qlLo B0kn0QaWuOM6Xhk4d9kexjnCzSWazJmUalv/RGo0GIXvNDPVE3tGamYlLZvTmjTgrHaj pGaAgIZbJQk/LRc17b2oLQEAz9Um5e2DF2FWi3aOfJK2y+BHG2bCjZ6FaNdAsOBhZ38u eS6mzeqJakCAIIhyM8ZSEEqEIOC0mwTpMLsO2vfYp+yo1BwnmqVsKxxUOVz7dSB6xbiT 9x/5eyfVdEq1Fm34TRzYSH9Rr2d4pdWvflF2vzscnOP8iEOkAw5n36yfNxQfGzExY7R0 OcZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GNGmWCPI; spf=pass (google.com: domain of linux-kernel+bounces-8750-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c28-20020a50d65c000000b005543b96bb94si235235edj.104.2023.12.21.08.17.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 08:17:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8750-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=@linaro.org header.s=google header.b=GNGmWCPI; spf=pass (google.com: domain of linux-kernel+bounces-8750-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 135AB1F25C1D for ; Thu, 21 Dec 2023 16:17:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A28A55E60; Thu, 21 Dec 2023 16:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GNGmWCPI" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 CF1BA53A17 for ; Thu, 21 Dec 2023 16:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so746677a12.1 for ; Thu, 21 Dec 2023 08:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703175410; x=1703780210; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JNDwzkyVbVWHRlDqAlVAzcdYLL04NDJIY3AGS0xxeec=; b=GNGmWCPI+4bPB0jMcjqWv2dQRgdruXpnDSHIN9F6ahzC9Bxnx1Av3pcA31WDlSKJsJ mb2e6rz3HOfBOHEvoNnLKUXqTSEYqaxkn1jwRaq+ytg/cdRV+oX07TX59AYsclRHXymd 2164+EOsTiF8fE0+PF2Zu3DyTcL9jNeN0qECmvbZnPV49MkPLQ114M/ZVH+DREkajZQY n/SzRM9pKi59mhLMiJYkHAHF2VCyXA1LHf5Sb+cD8/eETCoEd1MLCnxX4UJZtAIchVcL uh6BaPX+dl9dgFxIOEo2Ac5VxMUng+bwpCM/WzejNR6rrbKiUL0bItbg6QG0x+jEm7f6 wq2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703175410; x=1703780210; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JNDwzkyVbVWHRlDqAlVAzcdYLL04NDJIY3AGS0xxeec=; b=ne6VnwDgbpUmFb7Pd8jTO1b/3qG+sJmzN6O/NCjVL2uEcKgrDzKTYgvyXo8RWYtCo7 xWjme/9F5pa8V7KxmrIuIFpBP4B//68VmIOzXJGL5I9agBseOluRwJrDGJh2z7Y1Wk0b VS3VlWHlHTVWAW10FndbZa/PCjFSXKxEFRUZYPB7UrQ1SLisv4cFhfig/8pg5HLDbj1h /14KjcHdjHdL3vVQcPN+Oe6EfWXmdZlxq8xk15eIX5o1KgW+7xLG9dEcV5LOGFyY6+BJ Ui3Uucy4+n0ayU6PvvMU+CIK6cRvILCJaso+iZxAiVO1B6/QlOEXS6M0FiGcK9qTz7Ou 0NxA== X-Gm-Message-State: AOJu0Yyr59IRsN5S74biKh8Pui/BFHHgS+YOKsfOgyfbWAFEDDGqMujv G0zwYXyXPjxzyzirBIYjRW7gmkKQaAgCKzTGjxkVEak2x+RPUTQabifvCA== X-Received: by 2002:a17:90b:3547:b0:28b:da84:164c with SMTP id lt7-20020a17090b354700b0028bda84164cmr1835002pjb.81.1703175410067; Thu, 21 Dec 2023 08:16:50 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231220065522.351915-1-sshegde@linux.vnet.ibm.com> <85230ed0-26a0-4f08-aab0-f0a6ce03abe8@linux.vnet.ibm.com> In-Reply-To: <85230ed0-26a0-4f08-aab0-f0a6ce03abe8@linux.vnet.ibm.com> From: Vincent Guittot Date: Thu, 21 Dec 2023 17:16:38 +0100 Message-ID: Subject: Re: [PATCH] sched: move access of avg_rt and avg_dl into existing helper functions To: Shrikanth Hegde Cc: mingo@kernel.org, peterz@infradead.org, dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org, srikar@linux.vnet.ibm.com, yu.c.chen@intel.com, tim.c.chen@linux.intel.com Content-Type: text/plain; charset="UTF-8" Hi Shrikanth, On Wed, 20 Dec 2023 at 15:49, Shrikanth Hegde wrote: > > > > On 12/20/23 7:29 PM, Vincent Guittot wrote: > > Hi Vincent, thanks for taking a look. > > > On Wed, 20 Dec 2023 at 07:55, Shrikanth Hegde > > wrote: > >> [...] > >> -#ifdef CONFIG_HAVE_SCHED_AVG_IRQ > >> - if (READ_ONCE(rq->avg_irq.util_avg)) > >> + if (cpu_util_irq(rq)) > > > > cpu_util_irq doesn't call READ_ONCE() > > > > > I see. Actually it would be right if cpu_util_irq does call READ_ONCE no? Yes, cpu_util_irq should call READ_ONCE() > > Sorry i havent yet understood the memory barriers in details. Please correct me > if i am wrong here, > since ___update_load_avg(&rq->avg_irq, 1) does use WRITE_ONCE and reading out this > value using cpu_util_irq on a different CPU should use READ_ONCE no? Yes > > > > >> return true; > >> -#endif > >> > >> return false; > >> } > >> @@ -9481,8 +9479,8 @@ static unsigned long scale_rt_capacity(int cpu) > >> * avg_thermal.load_avg tracks thermal pressure and the weighted > >> * average uses the actual delta max capacity(load). > >> */ > >> - used = READ_ONCE(rq->avg_rt.util_avg); > >> - used += READ_ONCE(rq->avg_dl.util_avg); > >> + used = cpu_util_rt(rq); > >> + used += cpu_util_dl(rq); > >> used += thermal_load_avg(rq); > >> > >> if (unlikely(used >= max)) > >> -- > >> 2.39.3 > >>