Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1256475lqb; Thu, 30 May 2024 05:24:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXoendaAQ5zwQrLvT/oq5+D/aQkrPOmDTyC2Ca7fiSuL3qXQowu3D0PUrRJy7xmMznxp7wKxPuCmBe4JuPd0dC8AW/2GbYsaogOiBNAgw== X-Google-Smtp-Source: AGHT+IEQaOMHoxFVEKmyrQr2iKjZaPYxXYG8Bdn/AVS7okUj0YvX3Y+dJcYLiysvZU5BbpPZqOEz X-Received: by 2002:a17:902:f1cb:b0:1f4:f1c1:646b with SMTP id d9443c01a7336-1f619610e86mr14750675ad.33.1717071872141; Thu, 30 May 2024 05:24:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717071872; cv=pass; d=google.com; s=arc-20160816; b=e8M6ODTQANyNud1T3X7BI/GmZ0/iGJtR6NkLef9SNmg6DdX818R32zNUIfuybuXx8d JFpE22DPlTJT1TJLZINUIh5kqkpIjmO2mIaxaxdDbU4Og4Tyi1BCDGkfLY2ZqaawAKWk bbsEQolajVXq5nDfDAVoCuFveNs1oYFviDi32Tqm7rAmyJ7nlTj+8tOwc1cVW6QXF1Jv EPkvRLog9GYOC2kInjVXjMcAI+HbUj9Sl5+dQ9KMAeXlyS85ub2TZ/JCh5LpM1glu20t cdVYAx0qKikIZvy+IPyZXDLxb0jhD0RtS2kln5z7S/LB/pZoJvLeXhlUEVVRLXPoE/+7 0PxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+enHyvCDfrlV8I1SIAZtQt+FfqmLa2z6v5AbXG0cKe0=; fh=Yh2beI2HuvY3Y2pXTbtWBICd9pd1pbJEzZtGI9uRUok=; b=0SIlrIh5VfRxFoXPsJmDefsi/SRAwA3B+E1EboUE3Xozr76UyQySly0VKeRIA0yQUJ DZwyHgChDuc7D7qpsDTUV6hMskzItDXZaKjNIZQjqzV5prV18H+ZdvtbeX0VmsRs0T+S MTlmggxb/lxKZ8K08lB4gpx9YcWvaW7UBwOtFEJ/DwOHo7/HL9aXZvN2K0mqacVLOx08 r00G8X+l2GtNeOfjRE2Gss+88pwmk+57+4HXLRd4Aby1vnw5/CvXFhwkbZpKuT1JA/vr urBENf1x3crbloT0us+k3LqLGWLrAITJUqaKoQCsWYyG66hAtLvpI9NPOptWdJAxzxM5 fONg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nsnGuFHP; 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-195355-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195355-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f49ce171a4si74118795ad.329.2024.05.30.05.24.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 05:24:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195355-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nsnGuFHP; 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-195355-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195355-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6CF91284FD7 for ; Thu, 30 May 2024 12:24:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D421F1C9EBE; Thu, 30 May 2024 12:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nsnGuFHP" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 CD49B16F0C1 for ; Thu, 30 May 2024 12:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717071867; cv=none; b=iFYlp6Xs5XE9++lCX8v2I0odq0xLkfsww46NH88w4760aLn6io8x0O0RbGawmKei0MJbZiUKjSOaWZQH2Fi4GUbRM7Vt/9nqDxeY/8xuUuYsXANisj6ykVSyfOBeNsEUipyleNw9RHzqBIxxA4c2I8qC8pzx4uGxtj2ouIde3Bc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717071867; c=relaxed/simple; bh=fq9tWX8EVrYYwkxAY6ecyjUvx+GGMcChLe/JfqCswhA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=p9/gr7rrN+j408V860BIfBmKxabIm8fi3JkuTUwlpevqy2Up3Ora9WuLUI7VUcWmWvoKZeqdGwbLUNE07+ugazIYXtd+8EM1TFZ2/Hhc9PsOS8ZCjFBjAUd3x7gr/lmRDr0sgFzmQ7y2+dh+HPNoHHpTerbZQh16NVcOGLiJPLA= 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=nsnGuFHP; arc=none smtp.client-ip=209.85.214.173 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-pl1-f173.google.com with SMTP id d9443c01a7336-1f44b59f8daso5199425ad.2 for ; Thu, 30 May 2024 05:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717071864; x=1717676664; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+enHyvCDfrlV8I1SIAZtQt+FfqmLa2z6v5AbXG0cKe0=; b=nsnGuFHPRCw2D5W3xF9H2DnY/22pBuhD/n/x0YmnBbww9n+G5Dj1z8DxoEv9Yaxa/H bLIeRNmW9pedahl1Zlfvgn79RATbufqClmFjubHeIBj4K4v+7/JLsNORtPcAn2LlzZLs yHC/ZE7tL/tjYf4K/EAhJr8Yj4GAcnUE3oF1lrLMS0SeHPLgIB2+6oFVB474mFzou8JL U0Qirygo6We31lXL822/hY6KRYT+kLJK0Y2XmUK7HmryAjNuWIqw+CilwupTtLttUl51 mR8XCHwaa0MDIi+0dKmNXeoLFhJqE5tujnmQmsCEyUxUiGtezs7NgIC4b1jl3NEItDBz W4kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717071864; x=1717676664; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+enHyvCDfrlV8I1SIAZtQt+FfqmLa2z6v5AbXG0cKe0=; b=YcffIsQSyv9DcBT6ZbhJpD16dVeck9pdar1ZNblHd66Iu7KlDV1QFkDEQtb0wAZIP/ 9eeTLB487R4WD+moTxMVec98EPzR9iBFPczK39xoszNd+sW3k178pKh0AOeSiGSf89Q+ gxVdPDvw/brE8K4DabEQEMHhmA3qrOM20PKf0gmbZPdaBlQ3zisx72OVf4iLRrzZuMri YAj5M3eNP0nb9Uj84Q9VBufHXzIYPpLMqXk4Xtd1ayj/wBtNM/k0zpu0UCPK3ilWjSay 1KPfK8nty70GewA5r0s1431joBY/i8sDyeXMV/L74qeAyVhCpDsXMlk6lR8uEZ3EMmOa 1vNg== X-Forwarded-Encrypted: i=1; AJvYcCXufUCgqewrXcQ6IgBmTXLOPlfyZlCh4MUhCZlskaAkOnP7P2bBniSGjNx1mUULOkb0YUD6slYpdLlLL7zEL1gJSF683+JuCezbKuIP X-Gm-Message-State: AOJu0YzsaNwrg9er1p7fA6E6htwztbwQOO3LObluisWiTwK3CiEkPuyh crUGQtp7vB8Sc9I5UnwNhmI+K19p3fICoBy+TKREJqUB5vSITTN9YntGEDvn X-Received: by 2002:a17:902:d490:b0:1f4:4631:d6a3 with SMTP id d9443c01a7336-1f61983a885mr19991425ad.42.1717071863973; Thu, 30 May 2024 05:24:23 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.28]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1f44c558ccdsm120548185ad.0.2024.05.30.05.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 05:24:23 -0700 (PDT) From: Ze Gao X-Google-Original-From: Ze Gao To: Frederic Weisbecker , Joel Fernandes , Thomas Gleixner , Peter Zijlstra , Ingo Molnar Cc: Cruz Zhao , linux-kernel@vger.kernel.org, Ze Gao Subject: [RFC PATCH 0/2] nohz idle time accounting cleanup Date: Thu, 30 May 2024 08:23:59 -0400 Message-ID: <20240530122401.3826022-1-zegao@tencent.com> X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Dear all, Currently we use is_idle_task(current) check to decide if we need to call tick_nohz_irq_enter() on irq entry but use idle_cpu() to decide if we need to call tick_nohz_irq_exit() on irq exit. and we rely this pair (which internally calls tick_nohz_stop_idle() and tick_nohz_start_idle() separately) to do accurate idle time accounting in most cases. IIUC, idle_cpu() now is mainly for scheduler and for tick user, we seem to ask less than what idle_cpu() gives us and the use of idle_cpu() here only make things complicated which can be proved by the introduction of sched_core_idle_cpu() for forcing idle time accounting. So I make this RFC to do this cleanup and make things simple again here and it should introduce no functional changes. Reviews welcome and please let me know if I'm being stupid or missing something obvious. Regards, Ze -- Ze Gao (2): timer: Use is_idle_task() check instead of idle_cpu() on irq exit sched/core: Remove sched_core_idle_cpu() include/linux/sched.h | 2 -- kernel/sched/core.c | 13 ------------- kernel/softirq.c | 2 +- 3 files changed, 1 insertion(+), 16 deletions(-) -- 2.41.0