Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1204017lqs; Fri, 14 Jun 2024 21:30:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5jH0kGuJwlrZbH8+LK7DYX0dLA/76uWZZvCs+7I6zyoiDQU2ymL8SjVU/KZM00KNtgvflmcEIpkX2Iq0pxRNn+ktqBK6h8oqyh5dolQ== X-Google-Smtp-Source: AGHT+IFyTQEXK/+MIR+lrSOyoZ87qm8t4il1SxrBM12k5atsnx+WuvMnFD/h1kzxAEz5d4ADK0/E X-Received: by 2002:a17:90a:3008:b0:2c4:ec56:35e9 with SMTP id 98e67ed59e1d1-2c4ec563bb6mr2681405a91.2.1718425840436; Fri, 14 Jun 2024 21:30:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718425840; cv=pass; d=google.com; s=arc-20160816; b=OpELB57lU1LZTdyEc5ldpSTiohE2eftS0MwVjFWxMOQlDQ/MSLJF43TCN+pqysJQyy NnEal4otASINIQULXj50v/S+EBWV4V9yq8WRB0ZkYfi5XgWsaAxoKDP3rln5zaoA6SxD 5G3NarFuWsPkZUaiaJJUWresxVG87m/TDWQxJh2zQyKLvbEzqUr4AQVF28hx5o6/eLQG IZfbTarOwezLGuPVuVh9LTaB6bVfX/nIwr1eCBqjF9qpH3hcBpV/vroFUyFW0Il7V6tZ OJuDiAKc+1b6E5NZhvfkgxUSaofzcdOkawgTbOrjK8UfDBdwRBSrM1JUaBHHTz0UiZ1L 44/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=biTC+V9v+0IuoKTuZRK4hT7YvOAuo0qgtjaFOA7jUc0=; fh=7mVA6ubh00hRoZOZma8FTPbahSTtz1yhMlP0Z9pxRzY=; b=k8TmX386MleAQ2CJJ7P8EZHAJhh124aH6NdH5LpGmH9MUltRalrDbN/5UPwscZlQXY 6T6mNGl7WE2ZUJRZ9AJ54HHUSw/JU5Px1GAUwOzWbhrIjzUXqEH46VAKcp3iJ9WbXMSt j9fmgwZRNWP4JxuLISFrO/+8ra055hJaHyDSKpYU4vparucr/KjqJ/K4n84lpVXDEstb UX9WjOVtcpU9eTBPkogiOWcDeuQTGRzRrs340OVmExHoSsiVcWL8SpQyEsr2Axx6mBOo OpmxkD71SVHezSARZoKxhyjvLkUcqcLI4k3SPbn2vs21kDO7NkxEtv1+9Hkc5mNxdf5k fdzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=l0JAE6Ik; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-215699-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215699-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a76abb35si6955485a91.92.2024.06.14.21.30.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 21:30:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215699-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=l0JAE6Ik; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-215699-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215699-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8F8CDB22AB6 for ; Sat, 15 Jun 2024 04:30:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29626E573; Sat, 15 Jun 2024 04:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="l0JAE6Ik" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 B5DA7139D for ; Sat, 15 Jun 2024 04:30:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718425828; cv=none; b=W4NietKAsKf4lupJaExioOg3XH166O00bAfVA/FX+no251pcjwn8Q2Mz+VkkrITHv5t5tLfgJ0XHxZLMPn4zYVf0Sp4hRhPKUaPsauc4LXlHfsX//f4pg16+YbQVkisgOA7Bxd/0kWTMNE5j40tpoIkC9uwqTb6RtN/XidS1alo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718425828; c=relaxed/simple; bh=et72wdh02USuUZ9T3Npp/+khcLFvzyihP6fMTFDqalk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=gL1q6wD28POfnsH52kRBjOf5FRlrSOZvv7BOsbzKY7AV/GIEob0z91/7JV1HGRrYPKBD52rpsV0H5voL5XtetJ9kJSKttOhCd/b/l1lmJwNfpNOJZbO6h5yiBgHwAf6yuXWN6jXMLM1TuTffs595t/9ogSv+cWiZyjpehSWddfg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=l0JAE6Ik; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-422f7c7af49so32185e9.0 for ; Fri, 14 Jun 2024 21:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718425825; x=1719030625; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=biTC+V9v+0IuoKTuZRK4hT7YvOAuo0qgtjaFOA7jUc0=; b=l0JAE6IknfnvW7FyFuh5sTes7jyDyw+DXXOCV0RrbIySOkt5G4GXL47zVjoW9PoSKU BPokFSP+2W9klA1pZKmsoye/SLZ5ZVhv8u+QBsVorMEvLepuUNRrqFdcCiHQUDLPMrET 7oN69VIbRCoJTlVtfky6YzqgOY9d9jKXqSEdz3xMDCeYxMHSCDRGdm8jP/jqBrc2IjOT UWMWgMp+3KjqFoWcdbQBAP+sH07RO9kk38lPKqGeYcgdRcYiTjwMG/Z94SEarXhd2oEP pw0jBAfwYn1Qm5UWWVZyRbXdIIFZkflCrP73U0e5ePJuDCUxCZExusi8p1JJoGTClvxK GoGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718425825; x=1719030625; h=content-transfer-encoding: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=biTC+V9v+0IuoKTuZRK4hT7YvOAuo0qgtjaFOA7jUc0=; b=u8AtRY9K8/SNNL3bc0MeTSsrPVFQC7WSxAIZf7xuw3+s9DDYDFnRHsKWrdqt7CZQkC J4nv0jwo63f4yLUWvjSpIDq+Qe0cEM23E5Fwx/cLXTjh3Jkh1B4RzUeM21QrYv195+UP zj8EZneMZi0xrtnv+lI7EBMGtZ62h6sgKID6Z6WESFfSNDU6OpgWK9ZT47/2VLkpWtze IALZsWQuwzHyV+ceA1rOv45dbBIGAud5G/QuAJkRsa9UkDjndXw8v/GcQN25e044U6pe 6qXip+bjEoJl0eIIW70xKppAVSUdfvn+qt3QTXBVYgkWatv3hFM+j5JI9MvGZKX6FMFk Djxw== X-Forwarded-Encrypted: i=1; AJvYcCXRGI57Vrj/u7zosG44Q8luOLLEXk+0iCqE+0frCKqf9fLTQrjW2lW34HeCPvFXS7l4gGee5gBEmgLGxYXbZdeEIiYtb9E1IAwa1RmP X-Gm-Message-State: AOJu0YyKMrMzCm5mN8iGeDquSPrQZU1KDJ+f7D9ffT3+4VK4PFDyiXqV WnswC0Y4KA1nCm3SLnYC9kJlV1xQAlbnhZm/bnVBZQY7yMaKvuuSbl2UDra0gEsf1MHOlxAXYCd AzYav90qZbNBMLX/7kynvmvBNOd8Fd2NuPYM= X-Received: by 2002:a05:600c:500f:b0:421:788b:7f21 with SMTP id 5b1f17b1804b1-423b5f934c1mr886875e9.2.1718425824830; Fri, 14 Jun 2024 21:30:24 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240613015837.4132703-1-jstultz@google.com> <20240613100441.GC17707@noisy.programming.kicks-ass.net> <20240613115142.kxrmlf3btmwjcprg@airbuntu> <20240614094833.GM8774@noisy.programming.kicks-ass.net> In-Reply-To: <20240614094833.GM8774@noisy.programming.kicks-ass.net> From: John Stultz Date: Fri, 14 Jun 2024 21:30:13 -0700 Message-ID: Subject: Re: [PATCH] RFC: sched: Rework task_sched_runtime to avoid calling update_rq_clock To: Peter Zijlstra Cc: Qais Yousef , LKML , Thomas Gleixner , Frederic Weisbecker , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Joel Fernandes , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 14, 2024 at 2:48=E2=80=AFAM Peter Zijlstra wrote: > On Thu, Jun 13, 2024 at 12:51:42PM +0100, Qais Yousef wrote: > > On 06/13/24 12:04, Peter Zijlstra wrote: > > > @@ -5459,6 +5458,8 @@ void sched_tick(void) > > > > > > sched_clock_tick(); > > > > > > + psi_account_irqtime(curr, &rq->psi_irq_time); > > > + > > > > If wakeup preemption causes a context switch, wouldn't we lose this > > information then? I *think* active migration might cause this informati= on to be > > lost too. > > I'm not sure what would be lost ?! the accounting is per cpu, not per > task afaict. That said,... > > > pick_next_task() might be a better place to do the accounting? > > Additionally, when there has been an effective cgroup switch. Only on > switch doesn't work for long running tasks, then the PSI information > will be artitrarily long out of date. > > Which then gets me something like the (completely untested) below.. > > Hmm? I applied and booted with this. It still takes the accounting out of the hotpath for the CLOCK_THREAD_CPUTIME_ID the microbenchmark performance is back to 5.10 numbers. I don't have any correctness tests for irqtime measurements, so I'll have to try to work something up for that next week. thanks -john