From patchwork Fri Dec 20 13:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koichiro Den X-Patchwork-Id: 13916775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 449E1E77188 for ; Fri, 20 Dec 2024 13:43:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67FF66B0085; Fri, 20 Dec 2024 08:43:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 62FFE6B0088; Fri, 20 Dec 2024 08:43:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 502AF6B0089; Fri, 20 Dec 2024 08:43:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 331B06B0085 for ; Fri, 20 Dec 2024 08:43:03 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 540E480A83 for ; Fri, 20 Dec 2024 13:42:54 +0000 (UTC) X-FDA: 82915451976.23.779B926 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by imf27.hostedemail.com (Postfix) with ESMTP id 6B2FD40002 for ; Fri, 20 Dec 2024 13:42:14 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=AF9UCfVz; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf27.hostedemail.com: domain of koichiro.den@canonical.com designates 185.125.188.122 as permitted sender) smtp.mailfrom=koichiro.den@canonical.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734702157; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=dQbg96P0DrKqCunYYx+ZxGswik+aV/Op1UtlU//A1LA=; b=amL6Z9rT1eZpXSv+ujJxbO3khH2QEXwgD1M7HOlx+/qa3fXufSfv5zEEL8/QeSeXmgNuS+ HpPbQZIcmDozfQoyMYoJlQvsZgwn6D7HiBidA2rdlqhX9jQOHCRXwtm7aLeKlRUGqlm9RG 2hNF+PGrzXa8NzxLHMP9pEGUlu5a2k0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734702157; a=rsa-sha256; cv=none; b=47ZVueMxJBp78tW7gkiCP+qc6nfwSmWJ8FSIeQJl+f04pIlhLPpX55SUSJSl8eDRJmdggA SSgVVzXk8nWaIjJ3pw04q8VTWrsG7JwL7/kfEA75EktJs079cu/ubDhrf6lQMFSGCSUXQi WddUrRfmkxJsVNczEztSNXRNUT17QRc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=AF9UCfVz; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf27.hostedemail.com: domain of koichiro.den@canonical.com designates 185.125.188.122 as permitted sender) smtp.mailfrom=koichiro.den@canonical.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 4341E3F84D for ; Fri, 20 Dec 2024 13:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1734702169; bh=dQbg96P0DrKqCunYYx+ZxGswik+aV/Op1UtlU//A1LA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AF9UCfVzRCQ/03fEWeh1OecoD3E38GGcI7b1ufy8cjllbCjGYBTh8sqDvui0OUoak b05vP7F9VNKtYunXEpwQSkKewSf1d3m9+NRTPtLtU+aVUuPPXt8mHvnZvzqJHE2co7 Y+VXKwpMTltifPSA6SF9t6lhJdlsrZGoTFft+YZJtxxdRai+2FilF4oPXjS5D4u3+0 t2HrjjgZEzaHI9tcGwgOZR3v22rCP6h9uqpJasCdm0VD4Fv61wWhYIVX0V90gl0rDW lfunVDNdhoqUgfrmmu84nzLteGz+9AxF3Ykv1p06xIkrW0peAdpZXgByDLvgqxEQc4 WAEHoOhkITNhQ== Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2163a2a1ec2so27734915ad.1 for ; Fri, 20 Dec 2024 05:42:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734702167; x=1735306967; 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=dQbg96P0DrKqCunYYx+ZxGswik+aV/Op1UtlU//A1LA=; b=rVJwBnkXWlBlBG7fw0rlsK62h8xV57KxjX1LOcWoJUSJHrzsES/7O+pNI1Q9KwKfdH zj524hwBp75O+D1iNuDdtmW6iTNxbL6eljoDZX5PXDy5fbHzSmUu70EfeJiFpqzQMxfB V41LMjOtkTmJRMRveG0HUGmBRJtW+M7Csud0u7TKDy9O1MnhiX5k8rW5fvUkXd+955Pz 2ovj0q4V9OCO0Vs2LuNd/1ilIm0o/hpMwarCbYZTNCkozPN5t93b+rgwIELU+zj2GgrO Wlwl16ALD2CmIJQ135ukpXq9f5voaswW0tqF5HAy8mZ3j11AHV3hiH5t1wnYRWhUYLih O/wQ== X-Gm-Message-State: AOJu0Yx2qsw1aW/UDRAlvpBFhb94t0BbqAao1uxveL69f/L9vziGmCyC g9UPFBaafYZfyWA42l1YA+RoOnGVg42jLj8/jrMAN+mrWq8mzElAqH5exTvHLaHF0ZGJ5G44k/o 9CKWJ4Z9KBz2qEl2HxWwvhGz948/oRUrse2/n05wi2FeIz3mCefCPupRBLNoY+kf++guFpbjS X-Gm-Gg: ASbGncubIBn8thb0X3yJ172VR7o9VNqHzRBGWLi1FFwAOVnF9GQkTQJpcGsT2qhl+Hc xiGKa5XGGnGys3C9Ufm6y18ekYYbIHE2N3FuZpTZ2TXtgHEDpDnxqQOKBIy6aa35QpVwOLuUTgG K4EAtJGImXaRiCmW6sGAonnnM1vHJyw8L0EYPPzqr+pr5ezbCZ1IMl7iE168aTZTH+jeX6VcNz1 hz/hrVlR18DV+81OX3Yh62IWubfAmX/DDjEf9swS87OYl6aBZdsjka/yA== X-Received: by 2002:a17:902:cec5:b0:219:d28a:ca23 with SMTP id d9443c01a7336-219e6f1484emr35635395ad.36.1734702167519; Fri, 20 Dec 2024 05:42:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0+o7XuJ3NsQg7m9m7Gszs7xbQkXpEKPiCC+7bq0dACwWfLK5OK/25UT8Pwg8Yjt1oW6/obQ== X-Received: by 2002:a17:902:cec5:b0:219:d28a:ca23 with SMTP id d9443c01a7336-219e6f1484emr35635015ad.36.1734702167074; Fri, 20 Dec 2024 05:42:47 -0800 (PST) Received: from z790sl.. ([240f:74:7be:1:3abc:18f3:dfe7:d8c3]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9cdd88sm28284935ad.122.2024.12.20.05.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 05:42:46 -0800 (PST) From: Koichiro Den To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] vmstat: disable vmstat_work on vmstat_cpu_down_prep() Date: Fri, 20 Dec 2024 22:42:34 +0900 Message-ID: <20241220134234.3809621-1-koichiro.den@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Stat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tAwhaSr0lyXkimH6iBZhII2Wvfov J7zY+SSC LjDeUSsXcJi3FMwojzwtZxunXBMypIMPr20USTkL7prKm4N21bFI5Rayq8BZ7B/Oq8GKLQ3/gzImwZfBqY2+iwCECLrNwKuL/bUSoRwSQs9L2QG4NNdt6n/7dTz++7ZhDJC19whanGzlHqglZlfztvUmEk/fC3vJ9YP2FIcInrhq+mQR8kKIK5YmXFlKTnVIreJgywvk9RsWZE0+GXOcchwtA+7VT651L6TDmZw0AJF7Naj8qN9frSH1/YAfhOnNqSVY1/gx5gDCBCiP/g8TbIpVO1FQgq5pO7Yr0LrG7y/G8wlYjwSjovCJmUbm3h2LM3lFP+GmzTo2QQSTcPwQSJz+AP3f15zbBtj3SdqM3mWWBljsC3GjfaA1xgdFah4hqYzvNXuN4C9TzS1V9/yyzPqIRuxaL761cc6kxAwaZHquWRMyhRPayyC3YVQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.158161, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Even after mm/vmstat:online teardown, shepherd may still queue work for the dying cpu until the cpu is removed from online mask. While it's quite rare, this means that after unbind_workers() unbinds a per-cpu kworker, it potentially runs vmstat_update for the dying CPU on an irrelevant cpu before entering STARTING section. When CONFIG_DEBUG_PREEMPT=y, it results in the following error with the backtrace. BUG: using smp_processor_id() in preemptible [00000000] code: \ kworker/7:3/1702 caller is refresh_cpu_vm_stats+0x235/0x5f0 CPU: 0 UID: 0 PID: 1702 Comm: kworker/7:3 Tainted: G Tainted: [N]=TEST Workqueue: mm_percpu_wq vmstat_update Call Trace: dump_stack_lvl+0x8d/0xb0 check_preemption_disabled+0xce/0xe0 refresh_cpu_vm_stats+0x235/0x5f0 vmstat_update+0x17/0xa0 process_one_work+0x869/0x1aa0 worker_thread+0x5e5/0x1100 kthread+0x29e/0x380 ret_from_fork+0x2d/0x70 ret_from_fork_asm+0x1a/0x30 So, disable vmstat_work reliably on vmstat_cpu_down_prep(). Signed-off-by: Koichiro Den --- mm/vmstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 4d016314a56c..44e1d87dcf01 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -2154,7 +2154,7 @@ static int vmstat_cpu_online(unsigned int cpu) static int vmstat_cpu_down_prep(unsigned int cpu) { - cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu)); + disable_delayed_work_sync(&per_cpu(vmstat_work, cpu)); return 0; }