Message ID | 20241221033321.4154409-1-koichiro.den@canonical.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 CBA72E77184 for <linux-mm@archiver.kernel.org>; Sat, 21 Dec 2024 03:33:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 097CD6B0083; Fri, 20 Dec 2024 22:33:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 01FF76B0088; Fri, 20 Dec 2024 22:33:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E02606B0089; Fri, 20 Dec 2024 22:33:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C1FFE6B0083 for <linux-mm@kvack.org>; Fri, 20 Dec 2024 22:33:42 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 14467AFDFA for <linux-mm@kvack.org>; Sat, 21 Dec 2024 03:33:42 +0000 (UTC) X-FDA: 82917544962.03.7506004 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by imf12.hostedemail.com (Postfix) with ESMTP id 90CF140005 for <linux-mm@kvack.org>; Sat, 21 Dec 2024 03:33:24 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=WVPduzhw; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf12.hostedemail.com: domain of koichiro.den@canonical.com designates 185.125.188.122 as permitted sender) smtp.mailfrom=koichiro.den@canonical.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734752003; a=rsa-sha256; cv=none; b=C4BVkV5VblAlguZC7jg0uTZn0NHl43cbierRW3g/o+0wtJxAHv8QqzmofRBV2RebpMng0V uXau10+fbSyAD3qUJEB4AmPcDVWcTpEeF8vZINFCzoYLbIznoBpPonefAwpuQbklR6ifpZ U/ExJuuw+ln9868eWkf+AEuSKDWCIyM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b=WVPduzhw; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf12.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=1734752003; 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=UH+BBa+34oarxAUGIoPwD94S9GCmmy/3HzyVbySzyaY=; b=S/llUYic19CcuUDW6OE4bZXIv9g9T8WCPt6ZpcI6zeLEhWbWYTkxy4bdd7/yQJH73jLyBT vFOXAW8+RaCzRZbj4IEapQlsUCGJmvOaN6jmkAomPq4s5q1J6MR7zcE4xdXAQ2xSa0FEBM 64NDsazJzxBL/Bx5BYDOhS0IFUo6Yiw= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (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 85BF73F47A for <linux-mm@kvack.org>; Sat, 21 Dec 2024 03:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1734752017; bh=UH+BBa+34oarxAUGIoPwD94S9GCmmy/3HzyVbySzyaY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WVPduzhwdehGokO3d9+BW9+OaBo30aU0OzDDj3sEtwrQkvAMlVhJ2F2IyrzKL0ns6 BmRrKbklMPi6H0np5p9u7TgOGLZZsCOwA+dz5m24rGHvERhxsTKY8m9vQbMJcRzAHe cf8/hJW32LXaORgeiPKeiUNQ9B42+yW5y0IZ4UoG2xH5m9Y1rICfmKmcqtenjhZMXt CdqWG51dZ3aYsHEbM/vXPigIFbGmuKKJrpQc/V//K7hHVe0eKHUKbhyuKjWNZSbHfh EYejYAG1GIA8xbW5JXQDR6H8U658CPqUsBFRyOU0D/cOawHCpjL6pBtmhYl2HTWpDI ZTbPsp8wBDEOg== Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-725e87a142dso3548060b3a.2 for <linux-mm@kvack.org>; Fri, 20 Dec 2024 19:33:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734752016; x=1735356816; 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=UH+BBa+34oarxAUGIoPwD94S9GCmmy/3HzyVbySzyaY=; b=nsKmdT+E3YNARzJOBC5UEwj3jVBDi4lqk3yXsimY7aYLBJ/oNCXADjd69fgi1RZZCn r8mgyBRKW8NywdYGx56QXMLJH6ufRe7yYkOwmWGy1Av5okLWTey/tQV+0wasBhuj+Kgd 30RQg1CNctpD8998VYzLoIM0Mw45pUDR0kRY5j06+vvnuyr/hx++vKSQfy8YBD4/3WXq /6lXj3x0FOXZYwraZiCZ6175WdApnflJB7QoanDmn29VvDD/Lyfo8oa5Oh3cld/qR2wV L/4ymja1mgyfczykpptrRCIdiAhBpEd1hmuzEoug6oUuwhRheoRCY46g0MpXTgQXk/UE uXCA== X-Gm-Message-State: AOJu0YzHP9leGYLbzUukNpd5+/K6toKk5REnsehoOuJ7Ml2ElLClxQEj r6KQFU1hg9CO4mTaZnl+c8SVA1/CNV7O6oBip9lZWOtRFoP0wklZvltvyxRWEUksofB6K+29eRB 1ihQFysTGI0VaaygPAaWGblA6jIjWftcOhygMVpX3u/bx7BgCInmZdltZ22CfAnixoUhFpImW X-Gm-Gg: ASbGncuHNdW1r0gf00Jy6oAW5zoGygu0/e/NoZUNYIzrCBb6Aol6FT5MS9v2ZpbSwIg 8DRHmI/j68nq8Vr7BZLibLV0iREjdDGoauyLNGmq1Q5Qw/+hcN2SeKM0ZEsMD8ESKoAB6q2rOvF wvYZfg+Xc32N0QiWrxhNQIGRz2JqcgmbUrt9v3R9X7qO+eC4st3iQjKFS5F8pmov9DsMoPwop6j FZ/fGrazpkkxb4XefxzbkSWNNrBBmfIkGHOCBjpunz5JN/VUIcZ+TkC X-Received: by 2002:a05:6a20:d045:b0:1db:f642:8d8b with SMTP id adf61e73a8af0-1e5e084ca80mr9176418637.45.1734752015928; Fri, 20 Dec 2024 19:33:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0F3IjP8On2mdtF9jLFuNUI+uNdfQWiRvRMexj+sJZcvnF+OhimUjhmi9F0LetMeVi9rui9A== X-Received: by 2002:a05:6a20:d045:b0:1db:f642:8d8b with SMTP id adf61e73a8af0-1e5e084ca80mr9176396637.45.1734752015602; Fri, 20 Dec 2024 19:33:35 -0800 (PST) Received: from z790sl.. ([240f:74:7be:1:3630:b0a:8446:1dba]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8157e2sm4011665b3a.26.2024.12.20.19.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 19:33:35 -0800 (PST) From: Koichiro Den <koichiro.den@canonical.com> To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] vmstat: disable vmstat_work on vmstat_cpu_down_prep() Date: Sat, 21 Dec 2024 12:33:20 +0900 Message-ID: <20241221033321.4154409-1-koichiro.den@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 90CF140005 X-Stat-Signature: 4iw7y189ub597mwk6zdhdeztff86r319 X-HE-Tag: 1734752004-499317 X-HE-Meta: U2FsdGVkX18oLA4IThMJs65YV2NMVnLITKuNLkMXImOj+q8mBSDMvH7We5RTP72xhzY7P1bWGAHFwRrF+FbB4R8Xo+UgQeREE2EOjBfLLe/7Y8GmUP9ae3XmBDCQlKiyUuklH7vcAZx81LYC1fkbtRJqYdvsG5zsokDmKky2c56hM/MES6bWMSZL9WeXN5H1qNLcyCHzcubHgwpDb0ciO4QCtgPFFDYQzLLznJeOGJVGdQHoXaKoNIzG8U92+FAvTmp/s9UId9WQ/voq9YQ6cTNoVbO62MdMcWjqked/P/vXAjM1PChv5nKw8hDKXpcjMfdigLoKgadf8Q56DKcbmlLhyGz5P5OdTKlE186HPPUpt2eTxye1s720y801D8udzTreR7PU15q63q/z0ly3VCkz2+wUXHpQyI4cXJppGtRXRQH7M1u7mv2gbFRvmTA4tswFCI+z8Xy7pDIHJ+Hh6vICG+8wV15aFMyoiyAkClpVM908mHFW15KBx9CIjUc+rqUqB0P8QXEAYmSMM4cayfCmeXfz2aR+oS3X9pjw10flb8AnmNpZ1JrzmKU2z9Ktga4Xr3WN4s0lGpt6Fw+pFfYa4JNnw6+IG46I9WYBotStM3h0JkAncbV4c7yL0kuDq5xZCoV9hKEJ1aktFPQqyl0J8pSSI+K2/wgKGxQNWlg63eAyJcyBbUKOjZROSbiic16zg9Hrqyfb5qHRHlJ0dg5LalgOQWkIWU6CnpZIbI3y9GJrWqlQoADam+omJ7TSW8awifS8rfLSKaAgZq6PLF2wi2NCWNImUqEbsCtR1LI9UfyXFkt4yI02BujQF1fWEDuvMBnKQB06B4f95MZWlh+/TKDC8rfOR5Tn9EMkCelhPE8KzS6gs0bOF2RO8NiBtJaXZo+dbBL/AO/2zscCvecUXdX38hdbbAQDK3NoYxNL3GG/TI6rTZOkqfEaraJvHS31H8S7mcvZ4qIJJfK GaXsA5C/ 71ZIw/pLCX6sf7zQwFrInkcnLzhruKdcp3uhgayPiRDYXmN+eWngdZDDa09ULNPT86Nb/FwQk69JZrGZtnv4H/SRIwICkGqm4eRWEEfHn9BUcAVsktA7wwhE6Je9GL2hbt85iFXR5DIr2TZHUdEsrZOtAofJsWV7OcwClHRPtF9kcSfqrL1urHKxMwc/sqlarMyRK4yS2i956TgZrLufbCUQ1T9LwNxC/ECglJ13w5wEVLtLRfFaoajKuprAwZaKsUkIGYae5DWxGc09rkmNgT4K8eDETW/xkVCdtKixX2/Xg6r2WKOFMypeknkj49vG7KO1WafBq/NerB+9fXP0i4uF8Xvpmwbf0G8I3wJo3DaRg1IRjX0F4LCcJc4DYt4U/b7cJ3sxe4zm1QQHu30PnE4aazWk1fj7boE19F+RbVoCWwu9Z7Zm8qri65biJQ3g1VFazHyspFHM30SYIYbbwUqsKjw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.275234, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[v2] vmstat: disable vmstat_work on vmstat_cpu_down_prep()
|
expand
|
diff --git a/mm/vmstat.c b/mm/vmstat.c index 4d016314a56c..0889b75cef14 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -2148,13 +2148,14 @@ static int vmstat_cpu_online(unsigned int cpu) if (!node_state(cpu_to_node(cpu), N_CPU)) { node_set_state(cpu_to_node(cpu), N_CPU); } + enable_delayed_work(&per_cpu(vmstat_work, cpu)); return 0; } 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; }
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 atomic AP states. 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: <TASK> 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 </TASK> So, for mm/vmstat:online, disable vmstat_work reliably on teardown and symmetrically enable it on startup. Signed-off-by: Koichiro Den <koichiro.den@canonical.com> --- v1: https://lore.kernel.org/all/20241220134234.3809621-1-koichiro.den@canonical.com/ --- mm/vmstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)