From patchwork Tue Mar 1 12:21:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12764682 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 5740CC433F5 for ; Tue, 1 Mar 2022 12:21:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86F438D0005; Tue, 1 Mar 2022 07:21:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D0568D0001; Tue, 1 Mar 2022 07:21:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 620AF8D0005; Tue, 1 Mar 2022 07:21:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 447EB8D0001 for ; Tue, 1 Mar 2022 07:21:53 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 129D081BF8 for ; Tue, 1 Mar 2022 12:21:53 +0000 (UTC) X-FDA: 79195728906.06.E6DFB5C Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf01.hostedemail.com (Postfix) with ESMTP id 7FA0C40004 for ; Tue, 1 Mar 2022 12:21:52 +0000 (UTC) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1646137310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkBV1p2duSsoNMrj3lAoV1bq8psnWoqvtGtulisyZvo=; b=mcYC9YHHcxfeuyhzzO2lCCjI97B1nOA6o7f+Uwyv65FMymcttSPv19lKK0WRBL7AZbZGDw aW6/JPK8NCu8HtmmwWYRHP7fqixuYxLvWTUq1f9rpVn7iVBmYicO4A90TRaPIOcr6twDKL qSemOLDdQeOQnRgxo1DJdQ8gE/LdYCryxzWTKwbgsKSUjABLA58HvsiEjk9lbGKdwGGeeP qIFinPAcZ3zfNrAra3yrn95dgOgUfg5Kwmb9JhPcV1PsLb2NVUrEien6uU7lJKi/UeouhT pdD99SBzhNcSGsGFQBCYv9fJBW8cUq6TYYfYBDQIQF5l/5fRlEEk4MEuY32p+g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1646137310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkBV1p2duSsoNMrj3lAoV1bq8psnWoqvtGtulisyZvo=; b=zAGbPeMcmFPlhqSZK14/x/lmF/lv2bSohWisuiGxy/cWxSlRLJ0WGfH7uPLUaLnAH1b26F iSG1Vg00XVK6LhCg== To: cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Johannes Weiner , Tejun Heo , Zefan Li , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH 2/2] mm: workingset: Replace IRQ-off check with a lockdep assert. Date: Tue, 1 Mar 2022 13:21:43 +0100 Message-Id: <20220301122143.1521823-3-bigeasy@linutronix.de> In-Reply-To: <20220301122143.1521823-1-bigeasy@linutronix.de> References: <[PATCH 0/2] Correct locking assumption on PREEMPT_RT> <20220301122143.1521823-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7FA0C40004 X-Stat-Signature: gnddfw11a7pjnambtqnajc1c8it6b5h1 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=mcYC9YHH; dkim=pass header.d=linutronix.de header.s=2020e header.b=zAGbPeMc; spf=pass (imf01.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-Rspam-User: X-HE-Tag: 1646137312-413916 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit 68d48e6a2df57 ("mm: workingset: add vmstat counter for shadow nodes") introduced an IRQ-off check to ensure that a lock is held which also disabled interrupts. This does not work the same way on PREEMPT_RT because none of the locks, that are held, disable interrupts. Replace this check with a lockdep assert which ensures that the lock is held. Signed-off-by: Sebastian Andrzej Siewior --- mm/workingset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/workingset.c b/mm/workingset.c index 2e4fd7c3296fe..8a3828acc0bfd 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -434,6 +434,8 @@ struct list_lru shadow_nodes; void workingset_update_node(struct xa_node *node) { + struct address_space *mapping; + /* * Track non-empty nodes that contain only shadow entries; * unlink those that contain pages or are being freed. @@ -442,7 +444,8 @@ void workingset_update_node(struct xa_node *node) * already where they should be. The list_empty() test is safe * as node->private_list is protected by the i_pages lock. */ - VM_WARN_ON_ONCE(!irqs_disabled()); /* For __inc_lruvec_page_state */ + mapping = container_of(node->array, struct address_space, i_pages); + lockdep_assert_held(&mapping->i_pages.xa_lock); if (node->count && node->count == node->nr_values) { if (list_empty(&node->private_list)) {