From patchwork Tue Mar 22 21:45:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789228 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 885F5C433FE for ; Tue, 22 Mar 2022 21:45:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 031716B0143; Tue, 22 Mar 2022 17:45:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F21536B0145; Tue, 22 Mar 2022 17:45:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3AAD6B0146; Tue, 22 Mar 2022 17:45:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id D2CF06B0143 for ; Tue, 22 Mar 2022 17:45:52 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 91663A5658 for ; Tue, 22 Mar 2022 21:45:52 +0000 (UTC) X-FDA: 79273354944.30.5341EC6 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 29B4840035 for ; Tue, 22 Mar 2022 21:45:52 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5A0C6119A; Tue, 22 Mar 2022 21:45:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E6EAC340F2; Tue, 22 Mar 2022 21:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985551; bh=5y73nK+IfYhE2dzuCLdG3voFW/Zf/4PV3Up3kcCaWYI=; h=Date:To:From:In-Reply-To:Subject:From; b=sjtkuscVntASDfgT3zmiaNhOOI6kH82m0qm0MTFbnF2tmYxduAtM419gkhGLEi5JB NXfq3dZkh2PAY1+SfTIufW58Lpgn5RlbGbSWaNBMsg6hGCxcY2BYnvXZTvOWbumwxR HoHjrdtu3koKT0HSbslAl2ytwOO8dusRMgdw7ihA= Date: Tue, 22 Mar 2022 14:45:50 -0700 To: tj@kernel.org,tglx@linutronix.de,lizefan.x@bytedance.com,hannes@cmpxchg.org,bigeasy@linutronix.de,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 144/227] mm: workingset: replace IRQ-off check with a lockdep assert. Message-Id: <20220322214551.0E6EAC340F2@smtp.kernel.org> X-Stat-Signature: xgkpaaodic8df9acwdepfroofkupexto Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=sjtkuscV; spf=pass (imf27.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 29B4840035 X-HE-Tag: 1647985552-817603 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: From: Sebastian Andrzej Siewior Subject: mm: workingset: replace IRQ-off check with a lockdep assert. 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. Link: https://lkml.kernel.org/r/20220301122143.1521823-3-bigeasy@linutronix.de Signed-off-by: Sebastian Andrzej Siewior Cc: Johannes Weiner Cc: Tejun Heo Cc: Zefan Li Cc: Thomas Gleixner Signed-off-by: Andrew Morton --- mm/workingset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/workingset.c~mm-workingset-replace-irq-off-check-with-a-lockdep-assert +++ a/mm/workingset.c @@ -433,6 +433,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. @@ -441,7 +443,8 @@ void workingset_update_node(struct xa_no * 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)) {