Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5026859rwb; Wed, 17 Aug 2022 09:46:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Xj2nWtQRj6WNbdYIH+hWYD1Z6JjrreOagOYEgEZPazd5Tzpe1VNCCrmcTX5cfS4Z4Q8Ut X-Received: by 2002:a17:907:7d86:b0:730:cd48:e2bc with SMTP id oz6-20020a1709077d8600b00730cd48e2bcmr17297967ejc.167.1660754765053; Wed, 17 Aug 2022 09:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660754765; cv=none; d=google.com; s=arc-20160816; b=I6DvUnYtLh/N7qW7Keo13QBPoEwq9CXKDYWCvZbSOko7VnwmLJ47D0PGthk255rQZi SwG+/0x9XmuOjOwRrg2m0ipcIUZJBI4dkFV4PYpdyj3ZLW63OuiN9ilMSR+Wnm66b6Vx p7qvX53uhSK01NvWw3erIv9NWVJ3a058omeGR8XYTlmhIEsVzwVpJLC4jAuowm34qVId weR5Eu1ektCwWNf5KG78aFFg15WkWBZGjvkRsvo5SnLxyV8OyUSjKXhxALMGUzQq+vWX 0GaXbpDndem1fzRUAXrRubRxfzPpLnhjiVX2eAZisCo9iOVGn8iRkJkWQmuY82WX4NPf ux1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=icKYkzOEkU10wqYj/AO1hlieqfsCO6opQIYue93MICc=; b=yEWMsPL7sM/TbNicISU8gJo0EwkPDfI5+bOhXcypKjQ3eYHfWbICauvAetD+K0e6Wh QeQTTiwp7Mh5an71wx9GyuBEz7kIsRRS8lPF0WoKBRjpXvWEw9LA5qvoCOdWHGWloRZx meP+eDotPCB2Fq0Vb0FGvRk432DOsnYgXIpDJ3fPjpTI05crucxQhCogH5yt2RqoUONn fDGJY6gJTo4HL4tHmUz2vMfqb8zjiqo2//eUKYJUym5xggLakzEnF130Y1LofnOxtgGM IMdV5poowgv9rLP/CFowJVnoyja7na0zeSMZtzBIAkZEB0XvnIUTOtFmNXAzJtYM2UTm jiQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WUwxVW+u; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt11-20020a170906ee8b00b00730881cddb4si270749ejb.454.2022.08.17.09.45.39; Wed, 17 Aug 2022 09:46:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WUwxVW+u; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241117AbiHQQ2O (ORCPT + 99 others); Wed, 17 Aug 2022 12:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239344AbiHQQ1l (ORCPT ); Wed, 17 Aug 2022 12:27:41 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17C72A031D; Wed, 17 Aug 2022 09:27:40 -0700 (PDT) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1660753657; 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=icKYkzOEkU10wqYj/AO1hlieqfsCO6opQIYue93MICc=; b=WUwxVW+uGIaO0szg7BxOu1wCzapAwDdXZYNPFf3kiI2xBtu8Es480fO/5T71TMYiQKTjL2 Y5lWxIQqJ7x7BoSnhKaFZCzRhG7+8yHeQ5/tmMMThFpP2L1agJ4szHQY5JVMPUakod0IbE yIc6Gl3i758gJbuMjFnB7KmeyFMZ5xJ0mfQb/Ikck/iVjEeodnOdRlmZ/pr1p0eX5sgM4R M4paCBlURfexAPIOmkPU+fjGxjbUG3Dnqp+YkiX1A4mHylwtylhelH9PtNbQGgVaw0NytL acYvZri+GlxU9tb6ucjTkjxdrXJYjietaE0V6tqA4Eq9vmaflVkD4q9k8U95TQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1660753657; 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=icKYkzOEkU10wqYj/AO1hlieqfsCO6opQIYue93MICc=; b=500tFezzQJcGWrboXp6CHY0SHvmE+zDVA//pAXoHOs0Jh0IxU+Aa1gSbSy/Lv6WZU3qbC3 94vz4DsO75E0UxCQ== To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Linus Torvalds , Matthew Wilcox , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , cgroups@vger.kernel.org, linux-mm@kvack.org, Sebastian Andrzej Siewior Subject: [PATCH 6/9] mm/memcontrol: Replace the PREEMPT_RT conditionals Date: Wed, 17 Aug 2022 18:27:00 +0200 Message-Id: <20220817162703.728679-7-bigeasy@linutronix.de> In-Reply-To: <20220817162703.728679-1-bigeasy@linutronix.de> References: <20220817162703.728679-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner Use VM_WARN_ON_IRQS_ENABLED() and preempt_disable/enable_nested() to replace the CONFIG_PREEMPT_RT #ifdeffery. Signed-off-by: Thomas Gleixner Cc: Johannes Weiner Cc: Michal Hocko Cc: Roman Gushchin Cc: Shakeel Butt Cc: Muchun Song Cc: cgroups@vger.kernel.org Cc: linux-mm@kvack.org Signed-off-by: Sebastian Andrzej Siewior --- mm/memcontrol.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b69979c9ced5c..d35b6fa560f0a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -597,25 +597,18 @@ static u64 flush_next_time; */ static void memcg_stats_lock(void) { -#ifdef CONFIG_PREEMPT_RT - preempt_disable(); -#else - VM_BUG_ON(!irqs_disabled()); -#endif + preempt_disable_nested(); + VM_WARN_ON_IRQS_ENABLED(); } =20 static void __memcg_stats_lock(void) { -#ifdef CONFIG_PREEMPT_RT - preempt_disable(); -#endif + preempt_disable_nested(); } =20 static void memcg_stats_unlock(void) { -#ifdef CONFIG_PREEMPT_RT - preempt_enable(); -#endif + preempt_enable_nested(); } =20 static inline void memcg_rstat_updated(struct mem_cgroup *memcg, int val) @@ -715,7 +708,7 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, en= um node_stat_item idx, * interrupt context while other caller need to have disabled interrupt. */ __memcg_stats_lock(); - if (IS_ENABLED(CONFIG_DEBUG_VM) && !IS_ENABLED(CONFIG_PREEMPT_RT)) { + if (IS_ENABLED(CONFIG_DEBUG_VM)) { switch (idx) { case NR_ANON_MAPPED: case NR_FILE_MAPPED: @@ -725,7 +718,7 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, en= um node_stat_item idx, WARN_ON_ONCE(!in_task()); break; default: - WARN_ON_ONCE(!irqs_disabled()); + VM_WARN_ON_IRQS_ENABLED(); } } =20 --=20 2.37.2