Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp498091lqo; Thu, 16 May 2024 12:13:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgjQnGWc+kRm+tsejCcLU4e8JPEVmkr1UvNOafU9kJOmfeEHSDuYYi/HFtSzKJm2u9E8KayE9eDMHZY+GXenTKDsamfYBndCfa9H2aeg== X-Google-Smtp-Source: AGHT+IHIHF09ZdQL1KSyIzNZU11WPNw7R44N+uH0m71f/hxupKcIfXK+u6/JW0r5Q+DKTK0h2JCy X-Received: by 2002:a05:620a:248a:b0:78d:6d44:35fe with SMTP id af79cd13be357-792c75ac3f1mr2646650985a.37.1715886813187; Thu, 16 May 2024 12:13:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715886813; cv=pass; d=google.com; s=arc-20160816; b=bskN1ocfI8QpMcuAITgURv+7EnSt77MDHuDi783vP50mlEj0Sd82ac6LyUUIzQmPMr gpoJDl8ngo7D107ey87cF3Kzj/EQigyk1zbn6z4h98niauAMkrvPrVtI66Sy7ZFETLlw UaQ4GHYeoQKo4hqIyCkk6+UE0TjzZhlHQ/sH9Br4kU6rfGLK5zNrR87yUnlzO/bgcUTL ddNx6LN5/n/HGQMVVEvNQL9KVwgEzbC95r0cyhUdTfTc0x4hF7ji0OQLdvDYVQJuBQrS m2p5oziN26MJ23kqBDl5lvM9BzZGXwfXKXvu9UWG88hwmGFpATOllQpMBLXSwtQ3nvF/ iwNg== 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:references:in-reply-to:message-id :date:subject:to:from; bh=KKc3fp/jI+BvIXedy1D0TYqFMPTw9ko9fdbmFGrVOU8=; fh=+J9ws/iMMNK/BuhShZhQjW5ON/LMJfMThv3J/wT2VeA=; b=M4Byf9W6oC2Jv2AGBhbEg4Y7/3Nii5BefCyB2g2tn3sJ7D/R57CzTCNsamzlAnRkis WKmgXSJtE+cTA/LZec3sVTeeO0vXmvvYs3pVXJ1xqYG8ArYwK0PBWcXDUMQTxXW+mx0Q g1AYweW1zbYeq3W0knuwQ4A8gERGOSewDOb4ilWW8hyrXtsx5JttQ6iyRZ/GgCopbfRW QmobE+MOX6nv6vF1A3rOfkuAXTwrviL3TYqZy3qh7LDmaCGKjj8tYD4wxZAtYY6Ulvx1 b/CQ7yjAuUbvvnH/aGmrFaII1Pr5+5nqtiRWOoysD2Q5lmvXKOPTINVY56mE+e1pf04e P1cw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792d0f94350si1226994285a.98.2024.05.16.12.13.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 12:13:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 08F861C23AF6 for ; Thu, 16 May 2024 19:13:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74BB315B966; Thu, 16 May 2024 19:08:33 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 5E60915B571; Thu, 16 May 2024 19:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715886513; cv=none; b=JlRCxH0bGJYUZRz6RMbOMCY/WvrSUdn+eHq3qTDLxXpEVZPBTjUpTRNQ+gSguf+ijvt7I0VedMiQiCxdndR5zxJDV/9efOtxVZ9UCD2TfT9WgjQS54Jdx3PKhCHjd2yGJBnsEvY2obNifxi3/AvjHnELa0L/eo619/upLwDlwiA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715886513; c=relaxed/simple; bh=8kbqqHhC8hqJWztiJ4S0vBrzZ4vEVAmywhl/Drj8bP8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U1DVRFsbszru4/RJYwuBXHclx0dxcTm3KpV4OXEjwPh6gpdVG6msW0H+HZvVa8LY2m/2HhsLBpKFMkCTLe/xrPmau49EnmG4RIqiX0r3ZuevlAoOMBqCIStMM+d2OsCcGZERXS6cyiJdt2DNO28vu5N0+eJTs6UxDhuy8LPRXnM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-420180b5897so34934195e9.3; Thu, 16 May 2024 12:08:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715886510; x=1716491310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KKc3fp/jI+BvIXedy1D0TYqFMPTw9ko9fdbmFGrVOU8=; b=drNowamVeICSyaeTWBAQUoIqHtkZGjREWEdR7cQi4lxBUB5vp8mqHNq+4t8Vv1pYtZ GaV5qn1/vN12rQBax6ADaQYaY5oewd1i2nMu1rXjp63ei3NMpWaNpPQqw6kD1hcDX+zj o1ECya54JQBs95HzjubTpeaFYYQpVzpUc5Q+raOW9jTuiwBa4ca3uzvj1bqFSXtlPmat deNdFVFwPvTnpCfEvemp/eGICtY8kQd4t+jG7KdEb7YPZXjtLGx6o8HPGSvmaQpGqpXs WHszNaKnh3geJHY2LGJBPDNkxw1RA0Bz64yJFEeqaBJTtpNr4btIE6+MQ9GQayphDWSv XWVw== X-Forwarded-Encrypted: i=1; AJvYcCV59nIk/Lo9vlRb7WRyQEiaYU/pj2/6RgT9hBoZW0UrwP5LjJLIslEvLP4jmENKkqCem9I8PTLdeYapLPvTtLI9jwi22gYxPFJNqEN2VH+LzBfqeQbSCKs3AYO77vA4QELw2aVYoQ== X-Gm-Message-State: AOJu0YyFpdClXn4TJXLVAAW6T0Vvu7+LOAQJ7R1pzaAIS+Kjq9YxFsrk y8BMCUUHYVTO8hEydGnaLWWhjXlUObbJUn+SZfapbfFAhtmmLNp+ X-Received: by 2002:a05:600c:4a16:b0:41a:5d49:6143 with SMTP id 5b1f17b1804b1-41feaa3873dmr163546945e9.12.1715886509604; Thu, 16 May 2024 12:08:29 -0700 (PDT) Received: from costa-tp.redhat.com ([2a00:a040:1a3:c059:8b18:f13e:da9b:5a8e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9335sm275834155e9.29.2024.05.16.12.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 12:08:29 -0700 (PDT) From: Costa Shulyupin To: longman@redhat.com, pauld@redhat.com, juri.lelli@redhat.com, prarit@redhat.com, vschneid@redhat.com, Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Zefan Li , Tejun Heo , Johannes Weiner , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Petr Mladek , Andrew Morton , Masahiro Yamada , Randy Dunlap , Yoann Congal , "Gustavo A. R. Silva" , Nhat Pham , Costa Shulyupin , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: [PATCH v1 5/7] [NOT-FOR-MERGE] test timers affinity adjustment Date: Thu, 16 May 2024 22:04:35 +0300 Message-ID: <20240516190437.3545310-6-costa.shul@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240516190437.3545310-1-costa.shul@redhat.com> References: <20240516190437.3545310-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There must be no timers on the specified cpu at the end of timers_resettle_from_cpu. Signed-off-by: Costa Shulyupin --- kernel/time/timer.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 2d15c0e7b0550..b7d253d230453 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2658,6 +2658,27 @@ int timers_prepare_cpu(unsigned int cpu) return 0; } +static int count_timers(int cpu) +{ + struct timer_base *base; + int b, v, count = 0; + + for (b = 0; b < NR_BASES; b++) { + base = per_cpu_ptr(&timer_bases[b], cpu); + raw_spin_lock_irq(&base->lock); + + for (v = 0; v < WHEEL_SIZE; v++) { + struct hlist_node *c; + + hlist_for_each(c, base->vectors + v) + count++; + } + raw_spin_unlock_irq(&base->lock); + } + + return count; +} + /** * timers_resettle_from_cpu - resettles timers from * specified cpu to housekeeping cpus. @@ -2697,6 +2718,7 @@ void timers_resettle_from_cpu(unsigned int cpu) raw_spin_unlock_irq(&new_base->lock); } local_irq_enable(); + WARN_ON(count_timers(cpu)); } int timers_dead_cpu(unsigned int cpu) -- 2.45.0